Spring AMQP

org.springframework.amqp.rabbit.support
Class ConsumerChannelRegistry

java.lang.Object
  extended by org.springframework.amqp.rabbit.support.ConsumerChannelRegistry

public class ConsumerChannelRegistry
extends Object

Consumers register their primary channels with this class. This is used to ensure that, when using transactions, the resource holder doesn't close the primary channel being used by the Consumer. This was previously in ConnectionFactoryUtils, but it caused a class tangle with RabbitResourceHolder.

Since:
1.2
Author:
Gary Russell

Constructor Summary
ConsumerChannelRegistry()
           
 
Method Summary
static com.rabbitmq.client.Channel getConsumerChannel()
          See registerConsumerChannel.
static void registerConsumerChannel(com.rabbitmq.client.Channel channel)
          If a listener container is configured to use a RabbitTransactionManager, the consumer's channel is registered here so that it is used as the bound resource when the transaction actually starts.
static void unRegisterConsumerChannel()
          See registerConsumerChannel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumerChannelRegistry

public ConsumerChannelRegistry()
Method Detail

registerConsumerChannel

public static void registerConsumerChannel(com.rabbitmq.client.Channel channel)
If a listener container is configured to use a RabbitTransactionManager, the consumer's channel is registered here so that it is used as the bound resource when the transaction actually starts. It is normally not necessary to use an external transaction manager because local transactions work the same in that the channel is bound to the thread. This is for the case when a user happens to wire in a RabbitTransactionManager.

Parameters:
channel -

unRegisterConsumerChannel

public static void unRegisterConsumerChannel()
See registerConsumerChannel. This method is called to unregister the channel when the consumer exits.


getConsumerChannel

public static com.rabbitmq.client.Channel getConsumerChannel()
See registerConsumerChannel. This method is called to retrieve the channel for this consumer.


Spring AMQP