Class ClosingRecoveryListener

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

    public final class ClosingRecoveryListener
    extends java.lang.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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      void handleRecovery​(com.rabbitmq.client.Recoverable recoverable)  
      void handleRecoveryStarted​(com.rabbitmq.client.Recoverable recoverable)  
      static void removeChannel​(com.rabbitmq.client.impl.recovery.AutorecoveringChannel channel)
      Remove the channel from the set used to ensure that addRecoveryListenerIfNecessary(Channel) is idempotent.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.rabbitmq.client.RecoveryListener

        handleTopologyRecoveryStarted
    • 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.