SpringSource/spring-amqp — pull request #72 by garyrussell (2012-10-25 22:34:13+00:00)
Title: AMQP-274 Local Transaction Issues

When running a listener container with local transactions
(channelTransacted, and no external transaction manager), the
consumer's channel is bound to the thread for use by downstream
RabbitTemplates.

However, the syncronizedWithTransaction boolean was not set so
the RabbitTemplate closed the channel after its operation.

We should never close the consumer's channel.

The solution is to set the boolean when binding the resource.

In addition, when using a RabbitTransactionManager, the
RabbitResourceHolder.closeAll() method would close the consumer's
channel.

Previously, the consumer's channel was registered with a
ThreadLocal in the ConnectionFactoryUtils. This enabled
the doGetTransactionalResourceHolder method to bind the
consumer's channel.

The RabbitResourceHolder.closeAll() now examines the channels
is it closing and skips the close for the consumer's channel.

Added tests to the Local and External transaction test cases
to ensure the appropriate channel.close() calls are executed,
depending on the scenario. e.g. a local transaction with
exposeListenerChannel=false should close() the exposed channel
but not the consumer's channel.

NEEDS BACKPORT TO 1.1.x