Class AbortSlowConsumerStrategy

    • Constructor Detail

      • AbortSlowConsumerStrategy

        public AbortSlowConsumerStrategy()
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable
      • abortConsumer

        public void abortConsumer​(Subscription sub,
                                  boolean abortSubscriberConnection)
      • getMaxSlowCount

        public long getMaxSlowCount()
      • setMaxSlowCount

        public void setMaxSlowCount​(long maxSlowCount)
        number of times a subscription can be deemed slow before triggering abort effect depends on dispatch rate as slow determination is done on dispatch
      • getMaxSlowDuration

        public long getMaxSlowDuration()
      • setMaxSlowDuration

        public void setMaxSlowDuration​(long maxSlowDuration)
        time in milliseconds that a sub can remain slow before triggering an abort.
        Parameters:
        maxSlowDuration -
      • getCheckPeriod

        public long getCheckPeriod()
      • setCheckPeriod

        public void setCheckPeriod​(long checkPeriod)
        time in milliseconds between checks for slow subscriptions
        Parameters:
        checkPeriod -
      • isAbortConnection

        public boolean isAbortConnection()
      • setAbortConnection

        public void setAbortConnection​(boolean abortConnection)
        abort the consumers connection rather than sending a stop command to the remote consumer
        Parameters:
        abortConnection -
      • isIgnoreNetworkSubscriptions

        public boolean isIgnoreNetworkSubscriptions()
        Returns whether the strategy is configured to ignore subscriptions that are from a network connection.
        Returns:
        true if the strategy will ignore network connection subscriptions when looking for slow consumers.
      • setIgnoreNetworkConsumers

        public void setIgnoreNetworkConsumers​(boolean ignoreNetworkConsumers)
        Sets whether the strategy is configured to ignore consumers that are part of a network connection to another broker. When configured to not ignore idle consumers this strategy acts 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 however for a network subscription this can create a lot of unnecessary churn and if the abort connection option is also enabled this can result in the entire network connection being torn down and rebuilt for no reason.
        Parameters:
        ignoreNetworkConsumers - Should this strategy ignore subscriptions made by a network connector.
      • setName

        public void setName​(String name)
      • getName

        public String getName()
      • 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
        Parameters:
        destination - A destination to add to a watch list.