Interface MessageReference
-
- All Known Subinterfaces:
PagedReference
- All Known Implementing Classes:
AbstractProtocolReference,GroupFirstMessageReference,MessageReferenceImpl,PagedReferenceImpl,QueryPagedReferenceImpl
public interface MessageReferenceA reference to a message. Channels store message references rather than the messages themselves.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMessageReference.Factory
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidacknowledge()voidacknowledge(Transaction tx)voidacknowledge(Transaction tx, AckReason reason, ServerConsumer consumer)voidacknowledge(Transaction tx, ServerConsumer consumer)MessageReferencecopy(Queue queue)voiddecrementDeliveryCount()voidemptyConsumerID()longgetConsumerId()intgetDeliveryCount()SimpleStringgetLastValueProperty()MessagegetMessage()longgetMessageID()intgetMessageMemoryEstimate()We define this method aggregation here because on paging we need to hold the original estimate, so we need to perform some extra steps on paging.intgetPersistedCount()longgetPersistentSize()This is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking for the amount of data on a queue<T> TgetProtocolData(Class<T> typeClass)To be used on holding protocol specific data during the delivery.QueuegetQueue()longgetScheduledDeliveryTime()voidhandled()booleanhasConsumerId()voidincrementDeliveryCount()booleanisAlreadyAcked()booleanisDurable()booleanisInDelivery()booleanisPaged()voidonDelivery(Consumer<? super MessageReference> callback)This is to be used in cases where a message delivery happens on an executor.voidsetAlreadyAcked()voidsetConsumerId(long consumerID)voidsetDeliveryCount(int deliveryCount)voidsetInDelivery(boolean alreadyDelivered)voidsetPersistedCount(int deliveryCount)<T> voidsetProtocolData(Class<T> typeClass, T data)To be used on holding protocol specific data during the delivery.voidsetScheduledDeliveryTime(long scheduledDeliveryTime)default booleanskipDelivery()
-
-
-
Method Detail
-
skipDelivery
default boolean skipDelivery()
-
isPaged
boolean isPaged()
-
getMessage
Message getMessage()
-
getMessageID
long getMessageID()
-
isDurable
boolean isDurable()
-
getLastValueProperty
SimpleString getLastValueProperty()
-
onDelivery
void onDelivery(Consumer<? super MessageReference> callback)
This is to be used in cases where a message delivery happens on an executor. Most MessageReference implementations will allow execution, and if it does, and the protocol requires an execution per message, this callback may be used. At the time of this implementation only AMQP was used.
-
getMessageMemoryEstimate
int getMessageMemoryEstimate()
We define this method aggregation here because on paging we need to hold the original estimate, so we need to perform some extra steps on paging.- Returns:
-
getProtocolData
<T> T getProtocolData(Class<T> typeClass)
To be used on holding protocol specific data during the delivery. This will be only valid while the message is on the delivering queue at the consumer
-
setProtocolData
<T> void setProtocolData(Class<T> typeClass, T data)
To be used on holding protocol specific data during the delivery. This will be only valid while the message is on the delivering queue at the consumer
-
copy
MessageReference copy(Queue queue)
-
getScheduledDeliveryTime
long getScheduledDeliveryTime()
- Returns:
- The time in the future that delivery will be delayed until, or zero if no scheduled delivery will occur
-
setScheduledDeliveryTime
void setScheduledDeliveryTime(long scheduledDeliveryTime)
-
getDeliveryCount
int getDeliveryCount()
-
setDeliveryCount
void setDeliveryCount(int deliveryCount)
-
setPersistedCount
void setPersistedCount(int deliveryCount)
-
getPersistedCount
int getPersistedCount()
-
incrementDeliveryCount
void incrementDeliveryCount()
-
decrementDeliveryCount
void decrementDeliveryCount()
-
getQueue
Queue getQueue()
-
acknowledge
void acknowledge(Transaction tx) throws Exception
- Throws:
Exception
-
acknowledge
void acknowledge(Transaction tx, ServerConsumer consumer) throws Exception
- Throws:
Exception
-
acknowledge
void acknowledge(Transaction tx, AckReason reason, ServerConsumer consumer) throws Exception
- Throws:
Exception
-
emptyConsumerID
void emptyConsumerID()
-
setConsumerId
void setConsumerId(long consumerID)
-
hasConsumerId
boolean hasConsumerId()
-
getConsumerId
long getConsumerId()
-
handled
void handled()
-
setInDelivery
void setInDelivery(boolean alreadyDelivered)
-
isInDelivery
boolean isInDelivery()
-
setAlreadyAcked
void setAlreadyAcked()
-
isAlreadyAcked
boolean isAlreadyAcked()
-
getPersistentSize
long getPersistentSize() throws ActiveMQExceptionThis is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking for the amount of data on a queue- Returns:
- Throws:
ActiveMQException
-
-