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 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 thataddRecoveryListenerIfNecessary(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 Details
-
handleRecovery
public void handleRecovery(com.rabbitmq.client.Recoverable recoverable) - Specified by:
handleRecovery
in interfacecom.rabbitmq.client.RecoveryListener
-
handleRecoveryStarted
public void handleRecoveryStarted(com.rabbitmq.client.Recoverable recoverable) - Specified by:
handleRecoveryStarted
in 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.
-