Class MessageReferenceImpl
- java.lang.Object
-
- org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node<MessageReferenceImpl>
-
- org.apache.activemq.artemis.core.server.impl.AbstractProtocolReference
-
- org.apache.activemq.artemis.core.server.impl.MessageReferenceImpl
-
- All Implemented Interfaces:
Runnable,MessageReference
public class MessageReferenceImpl extends AbstractProtocolReference implements MessageReference, Runnable
Implementation of a MessageReference
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.activemq.artemis.core.server.MessageReference
MessageReference.Factory
-
-
Constructor Summary
Constructors Constructor Description MessageReferenceImpl()MessageReferenceImpl(Message message, Queue queue)MessageReferenceImpl(MessageReferenceImpl other, Queue queue)
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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()booleanequals(Object other)longgetConsumerId()intgetDeliveryCount()static Comparator<MessageReference>getIDComparator()SimpleStringgetLastValueProperty()static intgetMemoryEstimate()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 queueQueuegetQueue()longgetScheduledDeliveryTime()voidhandled()booleanhasConsumerId()inthashCode()voidincrementDeliveryCount()booleanisAlreadyAcked()booleanisDurable()booleanisInDelivery()booleanisPaged()voidonDelivery(Consumer<? super MessageReference> onDelivery)This is to be used in cases where a message delivery happens on an executor.voidrun()It will callConsumer.accept(Object)onthisof theConsumerregistered inonDelivery(Consumer), if any.voidsetAlreadyAcked()voidsetConsumerId(long consumerID)voidsetDeliveryCount(int deliveryCount)voidsetInDelivery(boolean inDelivery)voidsetPersistedCount(int persistedCount)voidsetScheduledDeliveryTime(long scheduledDeliveryTime)StringtoString()-
Methods inherited from class org.apache.activemq.artemis.core.server.impl.AbstractProtocolReference
getProtocolData, setProtocolData
-
Methods inherited from class org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node
next, prev, val
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.MessageReference
getProtocolData, setProtocolData, skipDelivery
-
-
-
-
Constructor Detail
-
MessageReferenceImpl
public MessageReferenceImpl()
-
MessageReferenceImpl
public MessageReferenceImpl(MessageReferenceImpl other, Queue queue)
-
-
Method Detail
-
getIDComparator
public static Comparator<MessageReference> getIDComparator()
-
onDelivery
public void onDelivery(Consumer<? super MessageReference> onDelivery)
Description copied from interface:MessageReferenceThis 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.- Specified by:
onDeliveryin interfaceMessageReference
-
run
public void run()
It will callConsumer.accept(Object)onthisof theConsumerregistered inonDelivery(Consumer), if any.
-
getPersistedCount
public int getPersistedCount()
- Specified by:
getPersistedCountin interfaceMessageReference- Returns:
- the persistedCount
-
setPersistedCount
public void setPersistedCount(int persistedCount)
- Specified by:
setPersistedCountin interfaceMessageReference- Parameters:
persistedCount- the persistedCount to set
-
copy
public MessageReference copy(Queue queue)
- Specified by:
copyin interfaceMessageReference
-
getMemoryEstimate
public static int getMemoryEstimate()
-
getDeliveryCount
public int getDeliveryCount()
- Specified by:
getDeliveryCountin interfaceMessageReference
-
setDeliveryCount
public void setDeliveryCount(int deliveryCount)
- Specified by:
setDeliveryCountin interfaceMessageReference
-
incrementDeliveryCount
public void incrementDeliveryCount()
- Specified by:
incrementDeliveryCountin interfaceMessageReference
-
decrementDeliveryCount
public void decrementDeliveryCount()
- Specified by:
decrementDeliveryCountin interfaceMessageReference
-
getScheduledDeliveryTime
public long getScheduledDeliveryTime()
- Specified by:
getScheduledDeliveryTimein interfaceMessageReference- Returns:
- The time in the future that delivery will be delayed until, or zero if no scheduled delivery will occur
-
setScheduledDeliveryTime
public void setScheduledDeliveryTime(long scheduledDeliveryTime)
- Specified by:
setScheduledDeliveryTimein interfaceMessageReference
-
getMessage
public Message getMessage()
- Specified by:
getMessagein interfaceMessageReference
-
getMessageID
public long getMessageID()
- Specified by:
getMessageIDin interfaceMessageReference
-
getQueue
public Queue getQueue()
- Specified by:
getQueuein interfaceMessageReference
-
isDurable
public boolean isDurable()
- Specified by:
isDurablein interfaceMessageReference
-
handled
public void handled()
- Specified by:
handledin interfaceMessageReference
-
setInDelivery
public void setInDelivery(boolean inDelivery)
- Specified by:
setInDeliveryin interfaceMessageReference
-
isInDelivery
public boolean isInDelivery()
- Specified by:
isInDeliveryin interfaceMessageReference
-
setAlreadyAcked
public void setAlreadyAcked()
- Specified by:
setAlreadyAckedin interfaceMessageReference
-
isAlreadyAcked
public boolean isAlreadyAcked()
- Specified by:
isAlreadyAckedin interfaceMessageReference
-
isPaged
public boolean isPaged()
- Specified by:
isPagedin interfaceMessageReference
-
acknowledge
public void acknowledge() throws Exception- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
public void acknowledge(Transaction tx) throws Exception
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
public void acknowledge(Transaction tx, ServerConsumer consumer) throws Exception
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
public void acknowledge(Transaction tx, AckReason reason, ServerConsumer consumer) throws Exception
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
emptyConsumerID
public void emptyConsumerID()
- Specified by:
emptyConsumerIDin interfaceMessageReference
-
setConsumerId
public void setConsumerId(long consumerID)
- Specified by:
setConsumerIdin interfaceMessageReference
-
hasConsumerId
public boolean hasConsumerId()
- Specified by:
hasConsumerIdin interfaceMessageReference
-
getConsumerId
public long getConsumerId()
- Specified by:
getConsumerIdin interfaceMessageReference
-
getLastValueProperty
public SimpleString getLastValueProperty()
- Specified by:
getLastValuePropertyin interfaceMessageReference
-
getMessageMemoryEstimate
public int getMessageMemoryEstimate()
Description copied from interface:MessageReferenceWe 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.- Specified by:
getMessageMemoryEstimatein interfaceMessageReference- Returns:
-
toString
public String toString()
- Overrides:
toStringin classLinkedListImpl.Node<MessageReferenceImpl>
-
getPersistentSize
public long getPersistentSize() throws ActiveMQExceptionDescription copied from interface:MessageReferenceThis 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- Specified by:
getPersistentSizein interfaceMessageReference- Returns:
- Throws:
ActiveMQException
-
-