public class ServerConsumerImpl extends Object implements ServerConsumer, ReadyListener
| Modifier and Type | Class and Description |
|---|---|
protected class |
ServerConsumerImpl.BrowserDeliverer |
| Modifier and Type | Field and Description |
|---|---|
protected ServerConsumerImpl.BrowserDeliverer |
browserDeliverer |
protected Deque<MessageReference> |
deliveringRefs |
protected Object |
lock |
protected Queue |
messageQueue |
| Constructor and Description |
|---|
ServerConsumerImpl(long id,
ServerSession session,
QueueBinding binding,
Filter filter,
boolean started,
boolean browseOnly,
StorageManager storageManager,
SessionCallback callback,
boolean preAcknowledge,
boolean strictUpdateDeliveryCount,
ManagementService managementService,
ActiveMQServer server) |
ServerConsumerImpl(long id,
ServerSession session,
QueueBinding binding,
Filter filter,
boolean started,
boolean browseOnly,
StorageManager storageManager,
SessionCallback callback,
boolean preAcknowledge,
boolean strictUpdateDeliveryCount,
ManagementService managementService,
boolean supportLargeMessage,
Integer credits,
ActiveMQServer server) |
| Modifier and Type | Method and Description |
|---|---|
void |
acknowledge(Transaction tx,
long messageID) |
void |
backToDelivering(MessageReference reference)
Some protocols may choose to send the message back to delivering instead of redeliver.
|
LinkedList<MessageReference> |
cancelRefs(boolean failed,
boolean lastConsumedAsDelivered,
Transaction tx) |
void |
close(boolean failed) |
String |
debug() |
void |
disconnect()
disconnect the consumer
|
void |
fireSlowConsumer() |
void |
forceDelivery(long sequence)
Prompt delivery and send a "forced delivery" message to the consumer.
|
void |
forceDelivery(long sequence,
Runnable r) |
AtomicInteger |
getAvailableCredits()
To be used on tests only
|
String |
getConnectionID() |
long |
getCreationTime() |
List<MessageReference> |
getDeliveringMessages() |
List<MessageReference> |
getDeliveringReferencesBasedOnProtocol(boolean remove,
Object protocolDataStart,
Object protocolDataEnd)
Remove references based on the protocolData.
|
Filter |
getFilter() |
long |
getID() |
Object |
getProtocolContext()
An object set by the Protocol implementation.
|
Object |
getProtocolData()
this is to be used with anything specific on a protocol head.
|
Queue |
getQueue() |
float |
getRate() |
String |
getSessionID() |
SlowConsumerDetectionListener |
getSlowConsumerDetecion() |
HandleStatus |
handle(MessageReference ref)
There was a change on semantic during 2.3 here.
We now first accept the message, and the actual deliver is done as part of Consumer.proceedDeliver(MessageReference). |
void |
individualAcknowledge(Transaction tx,
long messageID) |
void |
individualCancel(long messageID,
boolean failed) |
boolean |
isBrowseOnly() |
void |
proceedDeliver(MessageReference reference)
This will proceed with the actual delivery.
|
void |
promptDelivery() |
void |
readyForWriting() |
void |
receiveCredits(int credits) |
void |
removeItself()
This method is just to remove itself from Queues.
|
MessageReference |
removeReferenceByID(long messageID) |
void |
setlowConsumerDetection(SlowConsumerDetectionListener listener) |
void |
setProtocolContext(Object protocolContext) |
void |
setProtocolData(Object protocolData)
this is to be used with anything specific on a protocol head.
|
void |
setStarted(boolean started) |
void |
setTransferring(boolean transferring) |
String |
toManagementString()
This method will create a string representation meant for management operations.
|
String |
toString() |
protected void |
updateDeliveryCountForCanceledRef(MessageReference ref,
boolean failed) |
protected final Queue messageQueue
protected final Object lock
protected ServerConsumerImpl.BrowserDeliverer browserDeliverer
protected final Deque<MessageReference> deliveringRefs
public ServerConsumerImpl(long id,
ServerSession session,
QueueBinding binding,
Filter filter,
boolean started,
boolean browseOnly,
StorageManager storageManager,
SessionCallback callback,
boolean preAcknowledge,
boolean strictUpdateDeliveryCount,
ManagementService managementService,
ActiveMQServer server)
throws Exception
Exceptionpublic ServerConsumerImpl(long id,
ServerSession session,
QueueBinding binding,
Filter filter,
boolean started,
boolean browseOnly,
StorageManager storageManager,
SessionCallback callback,
boolean preAcknowledge,
boolean strictUpdateDeliveryCount,
ManagementService managementService,
boolean supportLargeMessage,
Integer credits,
ActiveMQServer server)
throws Exception
Exceptionpublic void readyForWriting()
readyForWriting in interface ReadyListenerpublic Object getProtocolData()
ServerConsumergetProtocolData in interface ServerConsumerpublic void setProtocolData(Object protocolData)
ServerConsumersetProtocolData in interface ServerConsumerpublic void setlowConsumerDetection(SlowConsumerDetectionListener listener)
setlowConsumerDetection in interface ServerConsumerpublic SlowConsumerDetectionListener getSlowConsumerDetecion()
getSlowConsumerDetecion in interface ServerConsumerpublic void fireSlowConsumer()
fireSlowConsumer in interface ServerConsumerpublic Object getProtocolContext()
ServerConsumergetProtocolContext in interface ServerConsumerpublic void setProtocolContext(Object protocolContext)
setProtocolContext in interface ServerConsumerServerConsumer.getProtocolContext()public long getID()
getID in interface ServerConsumerpublic boolean isBrowseOnly()
isBrowseOnly in interface ServerConsumerpublic long getCreationTime()
getCreationTime in interface ServerConsumerpublic String getConnectionID()
getConnectionID in interface ServerConsumerpublic String getSessionID()
getSessionID in interface ServerConsumerpublic List<MessageReference> getDeliveringMessages()
getDeliveringMessages in interface Consumerpublic HandleStatus handle(MessageReference ref) throws Exception
ConsumerConsumer.proceedDeliver(MessageReference). This is to avoid holding a lock on the queues while
the delivery is being accomplished To avoid a lock on the queue in case of misbehaving
consumers.
This should return busy if handle is called before proceed deliver is called
public void proceedDeliver(MessageReference reference) throws Exception
ConsumerproceedDeliver in interface ConsumerExceptionpublic void close(boolean failed)
throws Exception
close in interface ServerConsumerExceptionpublic void removeItself()
throws Exception
ServerConsumerremoveItself in interface ServerConsumerExceptionpublic void forceDelivery(long sequence)
When the consumer receives such a "forced delivery" message, it discards it and knows that there are no other messages to be delivered.
forceDelivery in interface ServerConsumerpublic void forceDelivery(long sequence,
Runnable r)
public LinkedList<MessageReference> cancelRefs(boolean failed, boolean lastConsumedAsDelivered, Transaction tx) throws Exception
cancelRefs in interface ServerConsumerExceptionprotected void updateDeliveryCountForCanceledRef(MessageReference ref, boolean failed)
public void setStarted(boolean started)
setStarted in interface ServerConsumerpublic void setTransferring(boolean transferring)
setTransferring in interface ServerConsumerpublic void receiveCredits(int credits)
receiveCredits in interface ServerConsumerpublic Queue getQueue()
getQueue in interface ServerConsumerpublic List<MessageReference> getDeliveringReferencesBasedOnProtocol(boolean remove, Object protocolDataStart, Object protocolDataEnd)
getDeliveringReferencesBasedOnProtocol in interface ServerConsumerpublic void acknowledge(Transaction tx, long messageID) throws Exception
acknowledge in interface ServerConsumerExceptionpublic void individualAcknowledge(Transaction tx, long messageID) throws Exception
individualAcknowledge in interface ServerConsumerExceptionpublic void individualCancel(long messageID,
boolean failed)
throws Exception
individualCancel in interface ServerConsumerExceptionpublic void backToDelivering(MessageReference reference)
ServerConsumerbackToDelivering in interface ServerConsumerpublic MessageReference removeReferenceByID(long messageID) throws Exception
removeReferenceByID in interface ServerConsumerExceptionpublic AtomicInteger getAvailableCredits()
public String toManagementString()
ConsumertoManagementString in interface Consumerpublic void disconnect()
Consumerdisconnect in interface Consumerpublic float getRate()
public void promptDelivery()
promptDelivery in interface ServerConsumerCopyright © 2018 JBoss by Red Hat. All rights reserved.