Class AbortSlowAckConsumerStrategy

  • All Implemented Interfaces:
    Runnable, SlowConsumerStrategy

    public class AbortSlowAckConsumerStrategy
    extends AbortSlowConsumerStrategy
    Abort slow consumers when they reach the configured threshold of slowness, default is that a consumer that has not Ack'd a message for 30 seconds is slow.
    • Constructor Detail

      • AbortSlowAckConsumerStrategy

        public AbortSlowAckConsumerStrategy()
    • Method Detail

      • addDestination

        public void addDestination​(Destination destination)
        Description copied from interface: SlowConsumerStrategy
        For Strategies that need to examine assigned destination for slow consumers periodically the destination is assigned here. If the strategy doesn't is event driven it can just ignore assigned destination.
        Specified by:
        addDestination in interface SlowConsumerStrategy
        Overrides:
        addDestination in class AbortSlowConsumerStrategy
        Parameters:
        destination - A destination to add to a watch list.
      • getMaxTimeSinceLastAck

        public long getMaxTimeSinceLastAck()
        Gets the maximum time since last Ack before a subscription is considered to be slow.
        Returns:
        the maximum time since last Ack before the consumer is considered to be slow.
      • setMaxTimeSinceLastAck

        public void setMaxTimeSinceLastAck​(long maxTimeSinceLastAck)
        Sets the maximum time since last Ack before a subscription is considered to be slow.
        Parameters:
        maxTimeSinceLastAck - the maximum time since last Ack (mills) before the consumer is considered to be slow.
      • isIgnoreIdleConsumers

        public boolean isIgnoreIdleConsumers()
        Returns whether the strategy is configured to ignore consumers that are simply idle, i.e consumers that have no pending acks (dispatch queue is empty).
        Returns:
        true if the strategy will ignore idle consumer when looking for slow consumers.
      • setIgnoreIdleConsumers

        public void setIgnoreIdleConsumers​(boolean ignoreIdleConsumers)
        Sets whether the strategy is configured to ignore consumers that are simply idle, i.e consumers that have no pending acks (dispatch queue is empty). When configured to not ignore idle consumers this strategy acks not only on consumers that are actually slow but also on any consumer that has not received any messages for the maxTimeSinceLastAck. This allows for a way to evict idle consumers while also aborting slow consumers.
        Parameters:
        ignoreIdleConsumers - Should this strategy ignore idle consumers or consider all consumers when checking the last ack time verses the maxTimeSinceLastAck value.