Class ClosingRecoveryListener
java.lang.Object
org.springframework.amqp.rabbit.connection.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 Summary
Modifier and TypeMethodDescriptionstatic voidaddRecoveryListenerIfNecessary(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.voidhandleRecovery(com.rabbitmq.client.Recoverable recoverable) voidhandleRecoveryStarted(com.rabbitmq.client.Recoverable recoverable) static voidremoveChannel(com.rabbitmq.client.impl.recovery.AutorecoveringChannel channel) Remove the channel from the set used to ensure thataddRecoveryListenerIfNecessary(Channel)is idempotent.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.rabbitmq.client.RecoveryListener
handleTopologyRecoveryStarted
-
Method Details
-
handleRecovery
public void handleRecovery(com.rabbitmq.client.Recoverable recoverable) - Specified by:
handleRecoveryin interfacecom.rabbitmq.client.RecoveryListener
-
handleRecoveryStarted
public void handleRecoveryStarted(com.rabbitmq.client.Recoverable recoverable) - Specified by:
handleRecoveryStartedin interfacecom.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 thataddRecoveryListenerIfNecessary(Channel)is idempotent.- Parameters:
channel- the channel to remove.
-