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 |
getConnectionClientID() |
String |
getConnectionID() |
String |
getConnectionLocalAddress()
Returns a string representation of the local address this connection is
connected to.
|
String |
getConnectionProtocolName()
Returns the name of the protocol for this Remoting Connection
|
String |
getConnectionRemoteAddress()
Returns a string representation of the remote address this connection is
connected to.
|
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() |
SimpleString |
getQueueAddress() |
SimpleString |
getQueueName() |
RoutingType |
getQueueType() |
float |
getRate() |
long |
getSequentialID()
an unique sequential ID for this consumer
|
String |
getSessionID() |
String |
getSessionName() |
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 |
reject(long messageID) |
void |
removeItself()
This method is just to remove itself from Queues.
|
MessageReference |
removeReferenceByID(long messageID) |
long |
sequentialID()
an unique sequential ID for this consumer
|
void |
setlowConsumerDetection(SlowConsumerDetectionListener listener) |
void |
setPreAcknowledge(boolean preAcknowledge) |
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) |
boolean |
supportsDirectDelivery()
i
|
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
Exception
public 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
Exception
public void readyForWriting()
readyForWriting
in interface ReadyListener
public long sequentialID()
Consumer
sequentialID
in interface Consumer
public Object getProtocolData()
ServerConsumer
getProtocolData
in interface ServerConsumer
public void setProtocolData(Object protocolData)
ServerConsumer
setProtocolData
in interface ServerConsumer
public void setlowConsumerDetection(SlowConsumerDetectionListener listener)
setlowConsumerDetection
in interface ServerConsumer
public SlowConsumerDetectionListener getSlowConsumerDetecion()
getSlowConsumerDetecion
in interface ServerConsumer
public void fireSlowConsumer()
fireSlowConsumer
in interface ServerConsumer
public Object getProtocolContext()
ServerConsumer
getProtocolContext
in interface ServerConsumer
public void setProtocolContext(Object protocolContext)
setProtocolContext
in interface ServerConsumer
ServerConsumer.getProtocolContext()
public long getID()
getID
in interface ServerConsumer
public boolean isBrowseOnly()
isBrowseOnly
in interface ServerConsumer
public long getCreationTime()
getCreationTime
in interface ServerConsumer
public String getConnectionID()
getConnectionID
in interface ServerConsumer
public String getSessionID()
getSessionID
in interface ServerConsumer
public List<MessageReference> getDeliveringMessages()
getDeliveringMessages
in interface Consumer
public boolean supportsDirectDelivery()
supportsDirectDelivery
in interface Consumer
SessionCallback.supportsDirectDelivery()
public HandleStatus handle(MessageReference ref) throws Exception
Consumer
Consumer.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
Consumer
proceedDeliver
in interface Consumer
Exception
public void close(boolean failed) throws Exception
close
in interface ServerConsumer
Exception
public void removeItself() throws Exception
ServerConsumer
removeItself
in interface ServerConsumer
Exception
public 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 ServerConsumer
public void forceDelivery(long sequence, Runnable r)
public LinkedList<MessageReference> cancelRefs(boolean failed, boolean lastConsumedAsDelivered, Transaction tx) throws Exception
cancelRefs
in interface ServerConsumer
Exception
protected void updateDeliveryCountForCanceledRef(MessageReference ref, boolean failed)
public void setStarted(boolean started)
setStarted
in interface ServerConsumer
public void setTransferring(boolean transferring)
setTransferring
in interface ServerConsumer
public void receiveCredits(int credits)
receiveCredits
in interface ServerConsumer
public Queue getQueue()
getQueue
in interface ServerConsumer
public List<MessageReference> getDeliveringReferencesBasedOnProtocol(boolean remove, Object protocolDataStart, Object protocolDataEnd)
getDeliveringReferencesBasedOnProtocol
in interface ServerConsumer
public void acknowledge(Transaction tx, long messageID) throws Exception
acknowledge
in interface ServerConsumer
Exception
public void individualAcknowledge(Transaction tx, long messageID) throws Exception
individualAcknowledge
in interface ServerConsumer
Exception
public void individualCancel(long messageID, boolean failed) throws Exception
individualCancel
in interface ServerConsumer
Exception
public void reject(long messageID) throws Exception
reject
in interface ServerConsumer
Exception
public void backToDelivering(MessageReference reference)
ServerConsumer
backToDelivering
in interface ServerConsumer
public MessageReference removeReferenceByID(long messageID) throws Exception
removeReferenceByID
in interface ServerConsumer
Exception
public AtomicInteger getAvailableCredits()
public String toManagementString()
Consumer
toManagementString
in interface Consumer
public void disconnect()
Consumer
disconnect
in interface Consumer
public float getRate()
public void promptDelivery()
promptDelivery
in interface ServerConsumer
public void setPreAcknowledge(boolean preAcknowledge)
public long getSequentialID()
ConsumerInfo
getSequentialID
in interface ConsumerInfo
public SimpleString getQueueName()
getQueueName
in interface ConsumerInfo
public RoutingType getQueueType()
getQueueType
in interface ConsumerInfo
public SimpleString getQueueAddress()
getQueueAddress
in interface ConsumerInfo
public String getSessionName()
getSessionName
in interface ConsumerInfo
public String getConnectionClientID()
getConnectionClientID
in interface ConsumerInfo
public String getConnectionProtocolName()
ConsumerInfo
getConnectionProtocolName
in interface ConsumerInfo
public String getConnectionLocalAddress()
ConsumerInfo
getConnectionLocalAddress
in interface ConsumerInfo
public String getConnectionRemoteAddress()
ConsumerInfo
getConnectionRemoteAddress
in interface ConsumerInfo
Copyright © 2018 JBoss by Red Hat. All rights reserved.