Class PrefetchSubscription

    • Field Detail

      • scheduler

        protected final org.apache.activemq.thread.Scheduler scheduler
      • dispatched

        protected final List<org.apache.activemq.broker.region.MessageReference> dispatched
      • usageManager

        protected final SystemUsage usageManager
      • pendingLock

        protected final Object pendingLock
      • dispatchLock

        protected final Object dispatchLock
    • Method Detail

      • pullMessage

        public org.apache.activemq.command.Response pullMessage​(ConnectionContext context,
                                                                org.apache.activemq.command.MessagePull pull)
                                                         throws Exception
        Allows a message to be pulled on demand by a client
        Throws:
        Exception
      • processMessageDispatchNotification

        public void processMessageDispatchNotification​(org.apache.activemq.command.MessageDispatchNotification mdn)
                                                throws Exception
        Description copied from interface: Subscription
        Used by a Slave Broker to update dispatch infomation
        Throws:
        Exception
      • assertAckMatchesDispatched

        protected void assertAckMatchesDispatched​(org.apache.activemq.command.MessageAck ack)
                                           throws JMSException
        Checks an ack versus the contents of the dispatched list. called with dispatchLock held
        Parameters:
        ack -
        Throws:
        JMSException - if it does not match
      • getInFlightSize

        public int getInFlightSize()
        Returns:
        the number of messages awaiting acknowledgement
      • isFull

        public boolean isFull()
        Used to determine if the broker can dispatch to the consumer.
        Returns:
        true if the subscription is full
      • isLowWaterMark

        public boolean isLowWaterMark()
        Returns:
        true when 60% or more room is left for dispatching messages
      • isHighWaterMark

        public boolean isHighWaterMark()
        Returns:
        true when 10% or less room is left for dispatching messages
      • getPendingQueueSize

        public int getPendingQueueSize()
        Returns:
        number of messages pending delivery
      • getPendingMessageSize

        public long getPendingMessageSize()
        Returns:
        size of the messages pending delivery
      • getDispatchedQueueSize

        public int getDispatchedQueueSize()
        Returns:
        number of messages dispatched to the client
      • getDequeueCounter

        public long getDequeueCounter()
        Returns:
        number of messages queued by the client
      • getDispatchedCounter

        public long getDispatchedCounter()
        Returns:
        number of messages dispatched to the client
      • getEnqueueCounter

        public long getEnqueueCounter()
        Returns:
        number of messages that matched the subscription
      • trackedInPendingTransaction

        protected boolean trackedInPendingTransaction​(org.apache.activemq.broker.region.MessageReference node)
      • setPendingBatchSize

        protected void setPendingBatchSize​(PendingMessageCursor pending,
                                           int numberToDispatch)
      • dispatch

        protected boolean dispatch​(org.apache.activemq.broker.region.MessageReference node)
                            throws IOException
        Throws:
        IOException
      • onDispatch

        protected void onDispatch​(org.apache.activemq.broker.region.MessageReference node,
                                  org.apache.activemq.command.Message message)
      • updateConsumerPrefetch

        public void updateConsumerPrefetch​(int newPrefetch)
        inform the MessageConsumer on the client to change it's prefetch
        Parameters:
        newPrefetch -
      • createMessageDispatch

        protected org.apache.activemq.command.MessageDispatch createMessageDispatch​(org.apache.activemq.broker.region.MessageReference node,
                                                                                    org.apache.activemq.command.Message message)
        Parameters:
        node -
        message -
        Returns:
        MessageDispatch
      • canDispatch

        protected abstract boolean canDispatch​(org.apache.activemq.broker.region.MessageReference node)
                                        throws IOException
        Use when a matched message is about to be dispatched to the client.
        Parameters:
        node -
        Returns:
        false if the message should not be dispatched to the client (another sub may have already dispatched it for example).
        Throws:
        IOException
      • isDropped

        protected abstract boolean isDropped​(org.apache.activemq.broker.region.MessageReference node)
      • acknowledge

        protected abstract void acknowledge​(ConnectionContext context,
                                            org.apache.activemq.command.MessageAck ack,
                                            org.apache.activemq.broker.region.MessageReference node)
                                     throws IOException
        Used during acknowledgment to remove the message.
        Throws:
        IOException
      • getMaxProducersToAudit

        public int getMaxProducersToAudit()
      • setMaxProducersToAudit

        public void setMaxProducersToAudit​(int maxProducersToAudit)
      • getMaxAuditDepth

        public int getMaxAuditDepth()
      • setMaxAuditDepth

        public void setMaxAuditDepth​(int maxAuditDepth)