Class AbstractSubscription

    • Field Detail

      • broker

        protected Broker broker
      • info

        protected org.apache.activemq.command.ConsumerInfo info
      • destinationFilter

        protected final org.apache.activemq.filter.DestinationFilter destinationFilter
      • prefetchExtension

        protected final AtomicInteger prefetchExtension
    • Method Detail

      • matches

        public boolean matches​(org.apache.activemq.broker.region.MessageReference node,
                               org.apache.activemq.filter.MessageEvaluationContext context)
                        throws IOException
        Description copied from interface: Subscription
        Is the subscription interested in the message?
        Specified by:
        matches in interface Subscription
        Returns:
        true if matching
        Throws:
        IOException
      • isWildcard

        public boolean isWildcard()
        Description copied from interface: Subscription
        Returns true if this subscription is a Wildcard subscription.
        Specified by:
        isWildcard in interface Subscription
        Returns:
        true if wildcard subscription.
      • matches

        public boolean matches​(org.apache.activemq.command.ActiveMQDestination destination)
        Description copied from interface: Subscription
        Is the subscription interested in messages in the destination?
        Specified by:
        matches in interface Subscription
        Returns:
        true if matching
      • remove

        public List<org.apache.activemq.broker.region.MessageReference> remove​(ConnectionContext context,
                                                                               Destination destination)
                                                                        throws Exception
        Description copied from interface: Subscription
        The subscription will be no longer be receiving messages from the destination.
        Specified by:
        remove in interface Subscription
        Returns:
        a list of un-acked messages that were added to the subscription.
        Throws:
        Exception
      • getConsumerInfo

        public org.apache.activemq.command.ConsumerInfo getConsumerInfo()
        Description copied from interface: Subscription
        The ConsumerInfo object that created the subscription.
        Specified by:
        getConsumerInfo in interface Subscription
      • gc

        public void gc()
        Description copied from interface: Subscription
        The subscription should release as may references as it can to help the garbage collector reclaim memory.
        Specified by:
        gc in interface Subscription
      • getInfo

        public org.apache.activemq.command.ConsumerInfo getInfo()
      • getSelectorExpression

        public org.apache.activemq.filter.BooleanExpression getSelectorExpression()
      • getSelector

        public String getSelector()
        Specified by:
        getSelector in interface Subscription
        Returns:
        the JMS selector on the current subscription
      • getObjectName

        public ObjectName getObjectName()
        Specified by:
        getObjectName in interface Subscription
        Returns:
        the JMX object name that this subscription was registered as if applicable
      • getPrefetchSize

        public int getPrefetchSize()
        Specified by:
        getPrefetchSize in interface Subscription
        Returns:
        the prefetch size that is configured for the subscription
      • isUsePrefetchExtension

        public boolean isUsePrefetchExtension()
      • setUsePrefetchExtension

        public void setUsePrefetchExtension​(boolean usePrefetchExtension)
      • setPrefetchSize

        public void setPrefetchSize​(int newSize)
      • isRecoveryRequired

        public boolean isRecoveryRequired()
        Description copied from interface: Subscription
        Informs the Broker if the subscription needs to intervention to recover it's state e.g. DurableTopicSubscriber may do
        Specified by:
        isRecoveryRequired in interface Subscription
        Returns:
        true if recovery required
        See Also:
        PendingMessageCursor
      • setSlowConsumer

        public void setSlowConsumer​(boolean val)
      • getActiveMQDestination

        public org.apache.activemq.command.ActiveMQDestination getActiveMQDestination()
        Specified by:
        getActiveMQDestination in interface SubscriptionRecovery
        Returns:
        the Destination associated with this Subscription
      • isBrowser

        public boolean isBrowser()
        Specified by:
        isBrowser in interface Subscription
        Returns:
        true if a browser
      • getInFlightMessageSize

        public long getInFlightMessageSize()
        Specified by:
        getInFlightMessageSize in interface Subscription
        Returns:
        the size in bytes of the messages awaiting acknowledgement
      • getInFlightUsage

        public int getInFlightUsage()
        Specified by:
        getInFlightUsage in interface Subscription
        Returns:
        the in flight messages as a percentage of the prefetch size
      • addDestination

        public void addDestination​(Destination destination)
        Add a destination
        Parameters:
        destination -
      • removeDestination

        public void removeDestination​(Destination destination)
        Remove a destination
        Parameters:
        destination -
      • countBeforeFull

        public int countBeforeFull()
        Specified by:
        countBeforeFull in interface Subscription
        Returns:
        the number of messages this subscription can accept before its full
      • doAddRecoveredMessage

        protected void doAddRecoveredMessage​(org.apache.activemq.broker.region.MessageReference message)
                                      throws Exception
        Throws:
        Exception
      • getTimeOfLastMessageAck

        public long getTimeOfLastMessageAck()
        Description copied from interface: Subscription
        Returns the time since the last Ack message was received by this subscription. If there has never been an ack this value should be set to the creation time of the subscription.
        Specified by:
        getTimeOfLastMessageAck in interface Subscription
        Returns:
        time of last received Ack message or Subscription create time if no Acks.
      • setTimeOfLastMessageAck

        public void setTimeOfLastMessageAck​(long value)
      • wakeupDestinationsForDispatch

        public void wakeupDestinationsForDispatch()
      • getPrefetchExtension

        public AtomicInteger getPrefetchExtension()
      • contractPrefetchExtension

        protected void contractPrefetchExtension​(int amount)
      • expandPrefetchExtension

        protected void expandPrefetchExtension​(int amount)
      • decrementPrefetchExtension

        protected void decrementPrefetchExtension​(int amount)