Class DurableTopicSubscription
java.lang.Object
org.apache.activemq.broker.region.AbstractSubscription
org.apache.activemq.broker.region.PrefetchSubscription
org.apache.activemq.broker.region.DurableTopicSubscription
- All Implemented Interfaces:
Subscription,SubscriptionRecovery,org.apache.activemq.usage.UsageListener
public class DurableTopicSubscription
extends PrefetchSubscription
implements org.apache.activemq.usage.UsageListener
-
Field Summary
Fields inherited from class org.apache.activemq.broker.region.PrefetchSubscription
dispatched, dispatchLock, pending, pendingLock, scheduler, usageManagerFields inherited from class org.apache.activemq.broker.region.AbstractSubscription
broker, context, destinationFilter, destinations, info, prefetchExtension -
Constructor Summary
ConstructorsConstructorDescriptionDurableTopicSubscription(Broker broker, SystemUsage usageManager, ConnectionContext context, org.apache.activemq.command.ConsumerInfo info, boolean keepDurableSubsActive) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidacknowledge(ConnectionContext context, org.apache.activemq.command.MessageAck ack, org.apache.activemq.broker.region.MessageReference node) Used during acknowledgment to remove the message.voidactivate(SystemUsage memoryManager, ConnectionContext context, org.apache.activemq.command.ConsumerInfo info, RegionBroker regionBroker) voidadd(ConnectionContext context, Destination destination) The subscription will be receiving messages from the destination.voidadd(org.apache.activemq.broker.region.MessageReference node) Used to add messages that match the subscription.protected booleancanDispatch(org.apache.activemq.broker.region.MessageReference node) Use when a matched message is about to be dispatched to the client.protected org.apache.activemq.command.MessageDispatchcreateMessageDispatch(org.apache.activemq.broker.region.MessageReference node, org.apache.activemq.command.Message message) voiddeactivate(boolean keepDurableSubsActive, long lastDeliveredSequenceId) voiddestroy()Release any references that we are holding.voidprotected voiddoAddRecoveredMessage(org.apache.activemq.broker.region.MessageReference message) voidgc()The subscription should release as may references as it can to help the garbage collector reclaim memory.final longintfinal booleanisActive()protected booleanisDropped(org.apache.activemq.broker.region.MessageReference node) booleanbooleanbooleanisFull()Used to determine if the broker can dispatch to the consumer.booleanvoidonUsageChanged(org.apache.activemq.usage.Usage usage, int oldPercentUsage, int newPercentUsage) protected voidprocessExpiredAck(ConnectionContext context, Destination dest, org.apache.activemq.broker.region.MessageReference node) voidremovePending(org.apache.activemq.broker.region.MessageReference node) voidsetOfflineTimestamp(long timestamp) protected voidsetPendingBatchSize(PendingMessageCursor pending, int numberToDispatch) voidsetSelector(String selector) Attempts to change the current active selector on the subscription.toString()protected booleantrackedInPendingTransaction(org.apache.activemq.broker.region.MessageReference node) voidunmatched(org.apache.activemq.broker.region.MessageReference node) store will have a pending ack for all durables, irrespective of the selector so we need to ack if node is un-matchedMethods inherited from class org.apache.activemq.broker.region.PrefetchSubscription
acknowledge, assertAckMatchesDispatched, countBeforeFull, dispatch, getDequeueCounter, getDispatchedCounter, getDispatchedQueueSize, getEnqueueCounter, getInFlightSize, getMaxAuditDepth, getMaxProducersToAudit, getPending, getPendingMessageSize, isHighWaterMark, isLowWaterMark, isRecoveryRequired, onDispatch, processMessageDispatchNotification, pullMessage, remove, remove, sendToDLQ, setMaxAuditDepth, setMaxProducersToAudit, setPending, setPrefetchSize, updateConsumerPrefetchMethods inherited from class org.apache.activemq.broker.region.AbstractSubscription
addDestination, addRecoveredMessage, contractPrefetchExtension, decrementPrefetchExtension, expandPrefetchExtension, getActiveMQDestination, getConsumedCount, getConsumerInfo, getContext, getCursorMemoryHighWaterMark, getDestinations, getInFlightMessageSize, getInFlightUsage, getInfo, getObjectName, getPrefetchExtension, getPrefetchSize, getSelector, getSelectorExpression, getSubscriptionStatistics, getTimeOfLastMessageAck, incrementConsumedCount, isBrowser, isSlowConsumer, isUsePrefetchExtension, isWildcard, matches, matches, removeDestination, resetConsumedCount, setCursorMemoryHighWaterMark, setObjectName, setSlowConsumer, setTimeOfLastMessageAck, setUsePrefetchExtension, wakeupDestinationsForDispatch
-
Constructor Details
-
DurableTopicSubscription
public DurableTopicSubscription(Broker broker, SystemUsage usageManager, ConnectionContext context, org.apache.activemq.command.ConsumerInfo info, boolean keepDurableSubsActive) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
-
Method Details
-
isActive
public final boolean isActive() -
getOfflineTimestamp
public final long getOfflineTimestamp() -
setOfflineTimestamp
public void setOfflineTimestamp(long timestamp) -
isFull
public boolean isFull()Description copied from class:PrefetchSubscriptionUsed to determine if the broker can dispatch to the consumer.- Specified by:
isFullin interfaceSubscription- Overrides:
isFullin classPrefetchSubscription- Returns:
- true if the subscription is full
-
gc
public void gc()Description copied from interface:SubscriptionThe subscription should release as may references as it can to help the garbage collector reclaim memory.- Specified by:
gcin interfaceSubscription- Overrides:
gcin classAbstractSubscription
-
unmatched
store will have a pending ack for all durables, irrespective of the selector so we need to ack if node is un-matched- Specified by:
unmatchedin interfaceSubscription- Overrides:
unmatchedin classAbstractSubscription- Throws:
IOException
-
setPendingBatchSize
- Overrides:
setPendingBatchSizein classPrefetchSubscription
-
add
Description copied from interface:SubscriptionThe subscription will be receiving messages from the destination.- Specified by:
addin interfaceSubscription- Overrides:
addin classPrefetchSubscription- Throws:
Exception
-
isEmpty
-
activate
public void activate(SystemUsage memoryManager, ConnectionContext context, org.apache.activemq.command.ConsumerInfo info, RegionBroker regionBroker) throws Exception - Throws:
Exception
-
deactivate
public void deactivate(boolean keepDurableSubsActive, long lastDeliveredSequenceId) throws Exception - Throws:
Exception
-
createMessageDispatch
protected org.apache.activemq.command.MessageDispatch createMessageDispatch(org.apache.activemq.broker.region.MessageReference node, org.apache.activemq.command.Message message) - Overrides:
createMessageDispatchin classPrefetchSubscription- Returns:
- MessageDispatch
-
add
Description copied from interface:SubscriptionUsed to add messages that match the subscription.- Specified by:
addin interfaceSubscription- Overrides:
addin classPrefetchSubscription- Throws:
ExceptionInterruptedExceptionIOException
-
dispatchPending
- Overrides:
dispatchPendingin classPrefetchSubscription- Throws:
IOException
-
removePending
public void removePending(org.apache.activemq.broker.region.MessageReference node) throws IOException - Throws:
IOException
-
processExpiredAck
protected void processExpiredAck(ConnectionContext context, Destination dest, org.apache.activemq.broker.region.MessageReference node) - Overrides:
processExpiredAckin classPrefetchSubscription
-
doAddRecoveredMessage
protected void doAddRecoveredMessage(org.apache.activemq.broker.region.MessageReference message) throws Exception - Overrides:
doAddRecoveredMessagein classAbstractSubscription- Throws:
Exception
-
getPendingQueueSize
public int getPendingQueueSize()- Specified by:
getPendingQueueSizein interfaceSubscription- Overrides:
getPendingQueueSizein classPrefetchSubscription- Returns:
- number of messages pending delivery
-
setSelector
Description copied from interface:SubscriptionAttempts to change the current active selector on the subscription. This operation is not supported for persistent topics.- Specified by:
setSelectorin interfaceSubscription- Overrides:
setSelectorin classAbstractSubscription- Throws:
jakarta.jms.InvalidSelectorException
-
canDispatch
protected boolean canDispatch(org.apache.activemq.broker.region.MessageReference node) Description copied from class:PrefetchSubscriptionUse when a matched message is about to be dispatched to the client.- Specified by:
canDispatchin classPrefetchSubscription- Returns:
- false if the message should not be dispatched to the client (another sub may have already dispatched it for example).
-
trackedInPendingTransaction
protected boolean trackedInPendingTransaction(org.apache.activemq.broker.region.MessageReference node) - Overrides:
trackedInPendingTransactionin classPrefetchSubscription
-
acknowledge
protected void acknowledge(ConnectionContext context, org.apache.activemq.command.MessageAck ack, org.apache.activemq.broker.region.MessageReference node) throws IOException Description copied from class:PrefetchSubscriptionUsed during acknowledgment to remove the message.- Specified by:
acknowledgein classPrefetchSubscription- Throws:
IOException
-
toString
-
getSubscriptionKey
-
destroy
public void destroy()Release any references that we are holding.- Specified by:
destroyin interfaceSubscription
-
onUsageChanged
public void onUsageChanged(org.apache.activemq.usage.Usage usage, int oldPercentUsage, int newPercentUsage) - Specified by:
onUsageChangedin interfaceorg.apache.activemq.usage.UsageListener
-
isDropped
protected boolean isDropped(org.apache.activemq.broker.region.MessageReference node) - Specified by:
isDroppedin classPrefetchSubscription
-
isKeepDurableSubsActive
public boolean isKeepDurableSubsActive() -
isEnableMessageExpirationOnActiveDurableSubs
public boolean isEnableMessageExpirationOnActiveDurableSubs()
-