Class ClosingRecoveryListener

  • All Implemented Interfaces:
    com.rabbitmq.client.RecoveryListener

    public final class ClosingRecoveryListener
    extends Object
    implements com.rabbitmq.client.RecoveryListener
    A RecoveryListener that closes the recovered channel, to avoid orphaned consumers.
    Since:
    1.7.10
    Author:
    Gary Russell
    • Method Detail

      • handleRecovery

        public void handleRecovery​(com.rabbitmq.client.Recoverable recoverable)
        Specified by:
        handleRecovery in interface com.rabbitmq.client.RecoveryListener
      • handleRecoveryStarted

        public void handleRecoveryStarted​(com.rabbitmq.client.Recoverable recoverable)
        Specified by:
        handleRecoveryStarted in interface com.rabbitmq.client.RecoveryListener
      • addRecoveryListenerIfNecessary

        public static void addRecoveryListenerIfNecessary​(com.rabbitmq.client.Channel channel)
        Add a listener if necessary so we can immediately close an autorecovered channel if necessary since the actual consumer will no longer exist. Idempotent operation.
        Parameters:
        channel - the channel.
      • removeChannel

        public static void removeChannel​(com.rabbitmq.client.impl.recovery.AutorecoveringChannel channel)
        Remove the channel from the set used to ensure that addRecoveryListenerIfNecessary(Channel) is idempotent.
        Parameters:
        channel - the channel to remove.