Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.12.3
-
None
-
Unknown
Description
Channels are not fully thread-safe (see below), as a result the RabbitMQProducer shouldn't use a single Channel. In short, Channels should be pooled, and each thread given a Channel from the pool.
http://www.rabbitmq.com/api-guide.html#channel-threads
applications should prefer using a Channel per thread instead of sharing the same Channel across multiple threads.
http://www.rabbitmq.com/javadoc/com/rabbitmq/client/Channel.html
An important caveat to this is that confirms are not handled properly when a Channel is shared between multiple threads. In that scenario, it is therefore important to ensure that the Channel instance is not accessed concurrently by multiple threads.