Class Queue
java.lang.Object
org.apache.activemq.broker.region.BaseDestination
org.apache.activemq.broker.region.Queue
- All Implemented Interfaces:
Destination,org.apache.activemq.command.Message.MessageDestination,org.apache.activemq.Service,IndexListener,org.apache.activemq.thread.Task,org.apache.activemq.usage.UsageListener
- Direct Known Subclasses:
TempQueue
public class Queue
extends BaseDestination
implements org.apache.activemq.thread.Task, org.apache.activemq.usage.UsageListener, IndexListener
The Queue is a List of MessageEntry objects that are dispatched to matching
subscriptions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.activemq.store.IndexListener
IndexListener.MessageContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<Subscription>protected QueueDispatchPendingListprotected static final org.slf4j.Loggerprotected PendingMessageCursorprotected final org.apache.activemq.thread.TaskRunnerFactoryprotected org.apache.activemq.thread.TaskRunnerFields inherited from class org.apache.activemq.broker.region.BaseDestination
blockedProducerWarningInterval, broker, brokerService, cursorMemoryHighWaterMark, deadLetterStrategy, DEFAULT_INACTIVE_TIMEOUT_BEFORE_GC, destination, destinationStatistics, DUPLICATE_FROM_STORE_MSG_PREFIX, EXPIRE_MESSAGE_PERIOD, expireMessagesPeriod, lastBlockedProducerWarnTime, MAX_AUDIT_DEPTH, MAX_BROWSE_PAGE_SIZE, MAX_PAGE_SIZE, MAX_PRODUCERS_TO_AUDIT, memoryUsage, regionBroker, scheduler, started, store, storeUsageHighWaterMark, systemUsageFields inherited from interface org.apache.activemq.broker.region.Destination
DEFAULT_BLOCKED_PRODUCER_WARNING_INTERVAL, DEFAULT_DEAD_LETTER_STRATEGY -
Constructor Summary
ConstructorsConstructorDescriptionQueue(BrokerService brokerService, org.apache.activemq.command.ActiveMQDestination destination, MessageStore store, DestinationStatistics parentStats, org.apache.activemq.thread.TaskRunnerFactory taskFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledge(ConnectionContext context, Subscription sub, org.apache.activemq.command.MessageAck ack, org.apache.activemq.broker.region.MessageReference node) voidaddSubscription(ConnectionContext context, Subscription sub) protected voidassignGroup(Subscription subs, MessageGroupMap messageGroupOwners, org.apache.activemq.broker.region.MessageReference n, String groupId) protected booleanassignMessageGroup(Subscription subscription, QueueMessageReference node) org.apache.activemq.command.Message[]browse()voidclearPendingMessages(int pendingAdditionsCount) intcopyMatchingMessages(ConnectionContext context, MessageReferenceFilter filter, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) Copies the messages matching the given filter up to the maximum number of matched messagesintcopyMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest) Copies the messages matching the given selectorintcopyMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) Copies the messages matching the given selector up to the maximum number of matched messagesbooleancopyMessageTo(ConnectionContext context, String messageId, org.apache.activemq.command.ActiveMQDestination dest) Copies the message matching the given messageIdprotected MessageReferenceFiltercreateMessageIdFilter(String messageId) protected MessageReferenceFiltercreateSelectorFilter(String selector) voidprotected voiddoBrowseList(List<org.apache.activemq.command.Message> browseList, int max, PendingList list, ReentrantReadWriteLock lock, ConnectionContext connectionContext, String name) voidgc()org.apache.activemq.command.ActiveMQDestinationintprotected org.slf4j.LoggergetLog()getMessage(String id) longlongintvoidinitialize the destinationbooleanbooleanbooleanprotected booleanbooleanbooleanbooleanbooleaniterate()voidmessageExpired(ConnectionContext context, org.apache.activemq.broker.region.MessageReference reference) voidmessageExpired(ConnectionContext context, Subscription subs, org.apache.activemq.broker.region.MessageReference reference) Inform the Destination a message has expiredintmoveMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest) Moves the messages matching the given selectorintmoveMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) Moves the messages matching the given selector up to the maximum number of matched messagesintmoveMatchingMessagesTo(ConnectionContext context, MessageReferenceFilter filter, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) Moves the messages matching the given filter up to the maximum number of matched messagesbooleanmoveMessageTo(ConnectionContext context, String messageId, org.apache.activemq.command.ActiveMQDestination dest) Moves the message matching the given messageIdbooleanmoveMessageTo(ConnectionContext context, QueueMessageReference m, org.apache.activemq.command.ActiveMQDestination dest) Move a messagevoidonAdd(IndexListener.MessageContext messageContext) called with some global index lock held so that a listener can do order dependent work non null MessageContext.onCompletion called when work is donevoidonUsageChanged(org.apache.activemq.usage.Usage usage, int oldPercentUsage, int newPercentUsage) protected voidpageInMessages(boolean force, int maxPageSize) voidvoidprocessDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) called on Queues in slave mode to allow dispatch to follow subscription choice of mastervoidpurge()intremoveMatchingMessages(String selector) Removes the messages matching the given selectorintremoveMatchingMessages(String selector, int maximumMessages) Removes the messages matching the given selector up to the maximum number of matched messagesintremoveMatchingMessages(MessageReferenceFilter filter, int maximumMessages) Removes the messages matching the given filter up to the maximum number of matched messagesbooleanremoveMessage(String messageId) Removes the message matching the given messageIdprotected voidprotected voidprotected voidremoveMessage(ConnectionContext context, Subscription sub, QueueMessageReference reference, org.apache.activemq.command.MessageAck ack) voidremoveSubscription(ConnectionContext context, Subscription sub, long lastDeliveredSequenceId) voidintretryMessages(ConnectionContext context, int maximumMessages) voidrollbackPendingCursorAdditions(org.apache.activemq.command.MessageId messageId) voidsend(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message message) voidsetAllConsumersExclusiveByDefault(boolean allConsumersExclusiveByDefault) voidsetConsumersBeforeDispatchStarts(int consumersBeforeDispatchStarts) voidsetDispatchPolicy(DispatchPolicy dispatchPolicy) voidsetMessageGroupMapFactory(MessageGroupMapFactory messageGroupMapFactory) voidsetMessages(PendingMessageCursor messages) voidsetOptimizedDispatch(boolean optimizedDispatch) voidsetPrioritizedMessages(boolean prioritizedMessages) voidsetStrictOrderDispatch(boolean strictOrderDispatch) voidsetTimeBeforeDispatchStarts(int timeBeforeDispatchStarts) voidsetUseConsumerPriority(boolean useConsumerPriority) booleanvoidstart()voidstop()toString()voidwakeup()optionally called by a Subscriber - to inform the Destination its ready for more messagesMethods inherited from class org.apache.activemq.broker.region.BaseDestination
addProducer, canGC, convertToNonRangedAck, createConnectionContext, dispose, duplicateFromStore, fastProducer, getBlockedProducerWarningInterval, getCursorMemoryHighWaterMark, getDeadLetterStrategy, getDestinationSequenceId, getDestinationStatistics, getExpireMessagesPeriod, getInactiveTimeoutBeforeGC, getMaxAuditDepth, getMaxBrowsePageSize, getMaxExpirePageSize, getMaxPageSize, getMaxProducersToAudit, getMemoryUsage, getMessageStore, getMinimumMessageSize, getName, getOptimizeMessageStoreInFlightLimit, getSlowConsumerStrategy, getStoreUsageHighWaterMark, getSystemUsage, getTempUsage, hasRegularConsumers, isActive, isAdvisoryForConsumed, isAdvisoryForDelivery, isAdvisoryForDiscardingMessages, isAdvisoryForDispatched, isAdvisoryForFastProducers, isAdvisoryForSlowConsumers, isAdvisoryWhenFull, isAlwaysRetroactive, isDisposed, isDLQ, isDoOptimzeMessageStorage, isEnableAudit, isFlowControlLogRequired, isFull, isGcIfInactive, isGcWithNetworkConsumers, isIncludeBodyForAdvisory, isLazyDispatch, isPersistJMSRedelivered, isPrioritizedMessages, isProducerFlowControl, isReduceMemoryFootprint, isSendAdvisoryIfNoConsumers, isSendDuplicateFromStoreToDLQ, isUseCache, markForGC, messageConsumed, messageDelivered, messageDiscarded, messageDispatched, onMessageWithNoConsumers, removeProducer, setAdvisoryForConsumed, setAdvisoryForDelivery, setAdvisoryForDiscardingMessages, setAdvisoryForDispatched, setAdvisoryForFastProducers, setAdvisoryForSlowConsumers, setAdvisoryWhenFull, setAlwaysRetroactive, setBlockedProducerWarningInterval, setCursorMemoryHighWaterMark, setDeadLetterStrategy, setDoOptimzeMessageStorage, setEnableAudit, setExpireMessagesPeriod, setGcIfInactive, setGcWithNetworkConsumers, setInactiveTimeoutBeforeGC, setIncludeBodyForAdvisory, setLazyDispatch, setMaxAuditDepth, setMaxBrowsePageSize, setMaxExpirePageSize, setMaxPageSize, setMaxProducersToAudit, setMemoryUsage, setMinimumMessageSize, setOptimizeMessageStoreInFlightLimit, setPersistJMSRedelivered, setProducerFlowControl, setReduceMemoryFootprint, setSendAdvisoryIfNoConsumers, setSendDuplicateFromStoreToDLQ, setSlowConsumerStrategy, setStoreUsageHighWaterMark, setUseCache, slowConsumer, waitForSpace, waitForSpace
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
taskFactory
protected final org.apache.activemq.thread.TaskRunnerFactory taskFactory -
taskRunner
protected org.apache.activemq.thread.TaskRunner taskRunner -
consumers
-
messages
-
dispatchPendingList
-
-
Constructor Details
-
Queue
public Queue(BrokerService brokerService, org.apache.activemq.command.ActiveMQDestination destination, MessageStore store, DestinationStatistics parentStats, org.apache.activemq.thread.TaskRunnerFactory taskFactory) throws Exception - Throws:
Exception
-
-
Method Details
-
singlePendingSend
public boolean singlePendingSend() -
getConsumers
- Specified by:
getConsumersin interfaceDestination- Specified by:
getConsumersin classBaseDestination
-
setPrioritizedMessages
public void setPrioritizedMessages(boolean prioritizedMessages) - Overrides:
setPrioritizedMessagesin classBaseDestination
-
initialize
Description copied from class:BaseDestinationinitialize the destination- Overrides:
initializein classBaseDestination- Throws:
Exception
-
addSubscription
- Specified by:
addSubscriptionin interfaceDestination- Overrides:
addSubscriptionin classBaseDestination- Throws:
Exception
-
removeSubscription
public void removeSubscription(ConnectionContext context, Subscription sub, long lastDeliveredSequenceId) throws Exception - Specified by:
removeSubscriptionin interfaceDestination- Overrides:
removeSubscriptionin classBaseDestination- Throws:
Exception
-
send
public void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message message) throws Exception - Specified by:
sendin interfaceDestination- Throws:
Exception
-
onAdd
Description copied from interface:IndexListenercalled with some global index lock held so that a listener can do order dependent work non null MessageContext.onCompletion called when work is done- Specified by:
onAddin interfaceIndexListener
-
rollbackPendingCursorAdditions
public void rollbackPendingCursorAdditions(org.apache.activemq.command.MessageId messageId) -
gc
public void gc()- Specified by:
gcin interfaceDestination
-
acknowledge
public void acknowledge(ConnectionContext context, Subscription sub, org.apache.activemq.command.MessageAck ack, org.apache.activemq.broker.region.MessageReference node) throws IOException - Specified by:
acknowledgein interfaceDestination- Throws:
IOException
-
getPendingMessageSize
public long getPendingMessageSize() -
getPendingMessageCount
public long getPendingMessageCount() -
toString
-
start
- Specified by:
startin interfaceorg.apache.activemq.Service- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.apache.activemq.Service- Throws:
Exception
-
getActiveMQDestination
public org.apache.activemq.command.ActiveMQDestination getActiveMQDestination()- Specified by:
getActiveMQDestinationin interfaceDestination- Overrides:
getActiveMQDestinationin classBaseDestination
-
getMessageGroupOwners
-
getDispatchPolicy
-
setDispatchPolicy
-
getMessageGroupMapFactory
-
setMessageGroupMapFactory
-
getMessages
-
setMessages
-
isUseConsumerPriority
public boolean isUseConsumerPriority() -
setUseConsumerPriority
public void setUseConsumerPriority(boolean useConsumerPriority) -
isStrictOrderDispatch
public boolean isStrictOrderDispatch() -
setStrictOrderDispatch
public void setStrictOrderDispatch(boolean strictOrderDispatch) -
isOptimizedDispatch
public boolean isOptimizedDispatch() -
setOptimizedDispatch
public void setOptimizedDispatch(boolean optimizedDispatch) -
getTimeBeforeDispatchStarts
public int getTimeBeforeDispatchStarts() -
setTimeBeforeDispatchStarts
public void setTimeBeforeDispatchStarts(int timeBeforeDispatchStarts) -
getConsumersBeforeDispatchStarts
public int getConsumersBeforeDispatchStarts() -
setConsumersBeforeDispatchStarts
public void setConsumersBeforeDispatchStarts(int consumersBeforeDispatchStarts) -
setAllConsumersExclusiveByDefault
public void setAllConsumersExclusiveByDefault(boolean allConsumersExclusiveByDefault) -
isAllConsumersExclusiveByDefault
public boolean isAllConsumersExclusiveByDefault() -
isResetNeeded
public boolean isResetNeeded() -
browse
public org.apache.activemq.command.Message[] browse()- Specified by:
browsein interfaceDestination
-
doBrowse
-
doBrowseList
protected void doBrowseList(List<org.apache.activemq.command.Message> browseList, int max, PendingList list, ReentrantReadWriteLock lock, ConnectionContext connectionContext, String name) throws Exception - Throws:
Exception
-
getMessage
-
purge
- Throws:
Exception
-
clearPendingMessages
public void clearPendingMessages(int pendingAdditionsCount) - Specified by:
clearPendingMessagesin interfaceDestination
-
removeMessage
Removes the message matching the given messageId- Throws:
Exception
-
removeMatchingMessages
Removes the messages matching the given selector- Returns:
- the number of messages removed
- Throws:
Exception
-
removeMatchingMessages
Removes the messages matching the given selector up to the maximum number of matched messages- Returns:
- the number of messages removed
- Throws:
Exception
-
removeMatchingMessages
public int removeMatchingMessages(MessageReferenceFilter filter, int maximumMessages) throws Exception Removes the messages matching the given filter up to the maximum number of matched messages- Returns:
- the number of messages removed
- Throws:
Exception
-
copyMessageTo
public boolean copyMessageTo(ConnectionContext context, String messageId, org.apache.activemq.command.ActiveMQDestination dest) throws Exception Copies the message matching the given messageId- Throws:
Exception
-
copyMatchingMessagesTo
public int copyMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest) throws Exception Copies the messages matching the given selector- Returns:
- the number of messages copied
- Throws:
Exception
-
copyMatchingMessagesTo
public int copyMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) throws Exception Copies the messages matching the given selector up to the maximum number of matched messages- Returns:
- the number of messages copied
- Throws:
Exception
-
copyMatchingMessages
public int copyMatchingMessages(ConnectionContext context, MessageReferenceFilter filter, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) throws Exception Copies the messages matching the given filter up to the maximum number of matched messages- Returns:
- the number of messages copied
- Throws:
Exception
-
moveMessageTo
public boolean moveMessageTo(ConnectionContext context, QueueMessageReference m, org.apache.activemq.command.ActiveMQDestination dest) throws Exception Move a message- Parameters:
context- connection contextm- QueueMessageReferencedest- ActiveMQDestination- Throws:
Exception
-
moveMessageTo
public boolean moveMessageTo(ConnectionContext context, String messageId, org.apache.activemq.command.ActiveMQDestination dest) throws Exception Moves the message matching the given messageId- Throws:
Exception
-
moveMatchingMessagesTo
public int moveMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest) throws Exception Moves the messages matching the given selector- Returns:
- the number of messages removed
- Throws:
Exception
-
moveMatchingMessagesTo
public int moveMatchingMessagesTo(ConnectionContext context, String selector, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) throws Exception Moves the messages matching the given selector up to the maximum number of matched messages- Throws:
Exception
-
moveMatchingMessagesTo
public int moveMatchingMessagesTo(ConnectionContext context, MessageReferenceFilter filter, org.apache.activemq.command.ActiveMQDestination dest, int maximumMessages) throws Exception Moves the messages matching the given filter up to the maximum number of matched messages- Throws:
Exception
-
retryMessages
- Throws:
Exception
-
iterate
public boolean iterate()- Specified by:
iteratein interfaceorg.apache.activemq.thread.Task- Returns:
- true if we would like to iterate again
- See Also:
-
Task.iterate()
-
pauseDispatch
public void pauseDispatch() -
resumeDispatch
public void resumeDispatch() -
isDispatchPaused
public boolean isDispatchPaused() -
createMessageIdFilter
-
createSelectorFilter
protected MessageReferenceFilter createSelectorFilter(String selector) throws jakarta.jms.InvalidSelectorException - Throws:
jakarta.jms.InvalidSelectorException
-
removeMessage
- Throws:
IOException
-
removeMessage
protected void removeMessage(ConnectionContext c, Subscription subs, QueueMessageReference r) throws IOException - Throws:
IOException
-
removeMessage
protected void removeMessage(ConnectionContext context, Subscription sub, QueueMessageReference reference, org.apache.activemq.command.MessageAck ack) throws IOException - Throws:
IOException
-
messageExpired
public void messageExpired(ConnectionContext context, org.apache.activemq.broker.region.MessageReference reference) -
messageExpired
public void messageExpired(ConnectionContext context, Subscription subs, org.apache.activemq.broker.region.MessageReference reference) Description copied from interface:DestinationInform the Destination a message has expired- Specified by:
messageExpiredin interfaceDestination
-
wakeup
public void wakeup()Description copied from interface:Destinationoptionally called by a Subscriber - to inform the Destination its ready for more messages- Specified by:
wakeupin interfaceDestination
-
assignMessageGroup
protected boolean assignMessageGroup(Subscription subscription, QueueMessageReference node) throws Exception - Throws:
Exception
-
assignGroup
protected void assignGroup(Subscription subs, MessageGroupMap messageGroupOwners, org.apache.activemq.broker.region.MessageReference n, String groupId) throws IOException - Throws:
IOException
-
pageInMessages
- Throws:
Exception
-
processDispatchNotification
public void processDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) throws Exception Description copied from interface:Destinationcalled on Queues in slave mode to allow dispatch to follow subscription choice of master- Specified by:
processDispatchNotificationin interfaceDestination- Overrides:
processDispatchNotificationin classBaseDestination- Throws:
Exception
-
onUsageChanged
public void onUsageChanged(org.apache.activemq.usage.Usage usage, int oldPercentUsage, int newPercentUsage) - Specified by:
onUsageChangedin interfaceorg.apache.activemq.usage.UsageListener
-
getLog
protected org.slf4j.Logger getLog()- Specified by:
getLogin classBaseDestination
-
isOptimizeStorage
protected boolean isOptimizeStorage()
-