Class GroupFirstMessageReference
- java.lang.Object
-
- org.apache.activemq.artemis.core.server.impl.GroupFirstMessageReference
-
- All Implemented Interfaces:
MessageReference
public class GroupFirstMessageReference extends Object implements MessageReference
This MessageReference should only be created the first time a group is assigned to a consumer, it allows us to make a copy of the message to add the property safely as a delivery semantic, without affecting the underlying message. The overhead is low, as noted above only should be created on first message in a group to a consumer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.activemq.artemis.core.server.MessageReference
MessageReference.Factory
-
-
Constructor Summary
Constructors Constructor Description GroupFirstMessageReference(SimpleString key, MessageReference messageReference)
-
Method Summary
All 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()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 queueObjectgetProtocolData()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 inDelivery)voidsetPersistedCount(int deliveryCount)voidsetProtocolData(Object data)To be used on holding protocol specific data during the delivery.voidsetScheduledDeliveryTime(long scheduledDeliveryTime)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.MessageReference
skipDelivery
-
-
-
-
Constructor Detail
-
GroupFirstMessageReference
public GroupFirstMessageReference(SimpleString key, MessageReference messageReference)
-
-
Method Detail
-
getMessage
public Message getMessage()
- Specified by:
getMessagein interfaceMessageReference
-
isPaged
public boolean isPaged()
- Specified by:
isPagedin interfaceMessageReference
-
getMessageID
public long getMessageID()
- Specified by:
getMessageIDin interfaceMessageReference
-
isDurable
public boolean isDurable()
- Specified by:
isDurablein interfaceMessageReference
-
getLastValueProperty
public SimpleString getLastValueProperty()
- Specified by:
getLastValuePropertyin interfaceMessageReference
-
onDelivery
public void onDelivery(Consumer<? super MessageReference> callback)
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
-
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:
-
getProtocolData
public Object getProtocolData()
Description copied from interface:MessageReferenceTo 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- Specified by:
getProtocolDatain interfaceMessageReference
-
setProtocolData
public void setProtocolData(Object data)
Description copied from interface:MessageReferenceTo 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- Specified by:
setProtocolDatain interfaceMessageReference
-
copy
public MessageReference copy(Queue queue)
- Specified by:
copyin 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
-
getDeliveryCount
public int getDeliveryCount()
- Specified by:
getDeliveryCountin interfaceMessageReference
-
setDeliveryCount
public void setDeliveryCount(int deliveryCount)
- Specified by:
setDeliveryCountin interfaceMessageReference
-
setPersistedCount
public void setPersistedCount(int deliveryCount)
- Specified by:
setPersistedCountin interfaceMessageReference
-
getPersistedCount
public int getPersistedCount()
- Specified by:
getPersistedCountin interfaceMessageReference
-
incrementDeliveryCount
public void incrementDeliveryCount()
- Specified by:
incrementDeliveryCountin interfaceMessageReference
-
decrementDeliveryCount
public void decrementDeliveryCount()
- Specified by:
decrementDeliveryCountin interfaceMessageReference
-
getQueue
public Queue getQueue()
- Specified by:
getQueuein 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
-
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
-
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
-
-