Class 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.
    • Field Detail

      • 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
    • Method Detail

      • singlePendingSend

        public boolean singlePendingSend()
      • onAdd

        public void onAdd​(IndexListener.MessageContext messageContext)
        Description copied from interface: IndexListener
        called 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:
        onAdd in interface IndexListener
      • rollbackPendingCursorAdditions

        public void rollbackPendingCursorAdditions​(org.apache.activemq.command.MessageId messageId)
      • gc

        public void gc()
        Specified by:
        gc in interface Destination
      • getPendingMessageSize

        public long getPendingMessageSize()
      • getPendingMessageCount

        public long getPendingMessageCount()
      • start

        public void start()
                   throws Exception
        Specified by:
        start in interface org.apache.activemq.Service
        Throws:
        Exception
      • stop

        public void stop()
                  throws Exception
        Specified by:
        stop in interface org.apache.activemq.Service
        Throws:
        Exception
      • setDispatchPolicy

        public void setDispatchPolicy​(DispatchPolicy dispatchPolicy)
      • setMessageGroupMapFactory

        public void setMessageGroupMapFactory​(MessageGroupMapFactory messageGroupMapFactory)
      • 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:
        browse in interface Destination
      • doBrowse

        public void doBrowse​(List<org.apache.activemq.command.Message> browseList,
                             int max)
      • removeMessage

        public boolean removeMessage​(String messageId)
                              throws Exception
        Removes the message matching the given messageId
        Throws:
        Exception
      • removeMatchingMessages

        public int removeMatchingMessages​(String selector)
                                   throws Exception
        Removes the messages matching the given selector
        Returns:
        the number of messages removed
        Throws:
        Exception
      • removeMatchingMessages

        public int removeMatchingMessages​(String selector,
                                          int maximumMessages)
                                   throws Exception
        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 context
        m - QueueMessageReference
        dest - 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
      • iterate

        public boolean iterate()
        Specified by:
        iterate in interface org.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()
      • messageExpired

        public void messageExpired​(ConnectionContext context,
                                   org.apache.activemq.broker.region.MessageReference reference)
      • wakeup

        public void wakeup()
        Description copied from interface: Destination
        optionally called by a Subscriber - to inform the Destination its ready for more messages
        Specified by:
        wakeup in interface Destination
      • pageInMessages

        protected void pageInMessages​(boolean force,
                                      int maxPageSize)
                               throws Exception
        Throws:
        Exception
      • onUsageChanged

        public void onUsageChanged​(org.apache.activemq.usage.Usage usage,
                                   int oldPercentUsage,
                                   int newPercentUsage)
        Specified by:
        onUsageChanged in interface org.apache.activemq.usage.UsageListener
      • isOptimizeStorage

        protected boolean isOptimizeStorage()