Interface ServerConsumer
- All Superinterfaces:
Consumer,ConsumerInfo,PriorityAware
- All Known Implementing Classes:
ServerConsumerImpl
-
Method Summary
Modifier and TypeMethodDescriptionacknowledge(Transaction tx, long messageID) voidaddAttachment(String key, Object attachment) Adds the given attachment to theServerConsumerwhich will overwrite any previously assigned value with the same key.booleanThe current queue settings will allow use of the Reference Execution and callback.voidbackToDelivering(MessageReference reference) Some protocols may choose to send the message back to delivering instead of redeliver.cancelRefs(boolean failed, boolean lastConsumedAsDelivered, Transaction tx) voidclose(boolean failed) voidvoidforceDelivery(long sequence) getAttachment(String key) Gets any attachment that has been assigned to thisServerConsumerusing the provided key.longlonggetID()An object set by the Protocol implementation. it could be anything pre-determined by the implementationthis is to be used with anything specific on a protocol head.getQueue()voidindividualAcknowledge(Transaction tx, long messageID) voidindividualCancel(long messageID, boolean failed) booleanvoidmetricsAcknowledge(MessageReference ref, Transaction transaction) This is needed when some protocols (OW) handle the acks themselves and need to update the metricsvoidreceiveCredits(int credits) voidreject(long messageID) voidremoveAttachment(String key) Remove the any attachment entry from theServerConsumerclearing any previously assigned valuevoidThis method is just to remove itself from Queues.removeReferenceByID(long messageID) scanDeliveringReferences(boolean remove, Function<MessageReference, Boolean> startFunction, Function<MessageReference, Boolean> endFunction) voidvoidsetProtocolContext(Object protocolContext) voidsetProtocolData(Object protocolData) this is to be used with anything specific on a protocol head.voidsetStarted(boolean started) voidsetTransferring(boolean transferring) Methods inherited from interface org.apache.activemq.artemis.core.server.Consumer
debug, disconnect, errorProcessing, failed, getBinding, getDeliveringMessages, getFilter, getPriority, handle, isClosed, proceedDeliver, promptDelivery, sequentialID, supportsDirectDelivery, toManagementStringMethods inherited from interface org.apache.activemq.artemis.core.server.ConsumerInfo
getConnectionClientID, getConnectionLocalAddress, getConnectionProtocolName, getConnectionRemoteAddress, getFilterString, getLastAcknowledgedTime, getLastDeliveredTime, getMessagesAcknowledged, getMessagesAcknowledgedAwaitingCommit, getMessagesDelivered, getMessagesDeliveredSize, getMessagesInTransit, getMessagesInTransitSize, getQueueAddress, getQueueName, getQueueType, getSequentialID, getSessionName
-
Method Details
-
setlowConsumerDetection
-
getSlowConsumerDetecion
SlowConsumerDetectionListener getSlowConsumerDetecion() -
fireSlowConsumer
void fireSlowConsumer() -
allowReferenceCallback
boolean allowReferenceCallback()The current queue settings will allow use of the Reference Execution and callback. -
getProtocolData
Object getProtocolData()this is to be used with anything specific on a protocol head. -
setProtocolData
this is to be used with anything specific on a protocol head. -
setProtocolContext
-
getProtocolContext
Object getProtocolContext()An object set by the Protocol implementation. it could be anything pre-determined by the implementation -
getID
long getID() -
getConnectionID
Object getConnectionID() -
close
- Throws:
Exception
-
removeItself
This method is just to remove itself from Queues. If for any reason during a close an exception occurred, the exception treatment will call removeItself what should take the consumer out of any queues.- Throws:
Exception
-
cancelRefs
List<MessageReference> cancelRefs(boolean failed, boolean lastConsumedAsDelivered, Transaction tx) throws Exception - Throws:
Exception
-
setStarted
void setStarted(boolean started) -
receiveCredits
void receiveCredits(int credits) -
getQueue
Queue getQueue() -
removeReferenceByID
- Throws:
Exception
-
backToDelivering
Some protocols may choose to send the message back to delivering instead of redeliver. For example openwire will redeliver through the client, so messages will go back to delivering list after rollback. -
scanDeliveringReferences
List<MessageReference> scanDeliveringReferences(boolean remove, Function<MessageReference, Boolean> startFunction, Function<MessageReference, Boolean> endFunction) -
acknowledge
- Throws:
Exception
-
individualAcknowledge
- Throws:
Exception
-
reject
- Throws:
Exception
-
individualCancel
- Throws:
Exception
-
forceDelivery
void forceDelivery(long sequence) -
setTransferring
void setTransferring(boolean transferring) -
isBrowseOnly
boolean isBrowseOnly() -
getCreationTime
long getCreationTime() -
getSessionID
String getSessionID() -
metricsAcknowledge
This is needed when some protocols (OW) handle the acks themselves and need to update the metrics- Parameters:
ref- the message referencetransaction- the tx
-
addAttachment
Adds the given attachment to theServerConsumerwhich will overwrite any previously assigned value with the same key.- Parameters:
key- The key used to identify the attachment.attachment- The actual value to store for the assigned key.
-
removeAttachment
Remove the any attachment entry from theServerConsumerclearing any previously assigned value- Parameters:
key- The key used to identify the attachment.
-
getAttachment
Gets any attachment that has been assigned to thisServerConsumerusing the provided key. If no value was assigned a null is returned.- Parameters:
key- The key identifying the target attachment.- Returns:
- the assigned value associated with the given key or null if nothing assigned.
-
getAttachments
Provides access to the fullMapof consumer attachments in an unmodifiableMapinstance. If no attachments are assigned to the consumer an emptyMapinstance is returned, never null.- Returns:
- an unmodifiable
Mapthat carries all consumer attachments.
-