A {@link ConnectionFactory} implementation that (when the cache mode is {@link CacheMode#CHANNEL} (default)returns the same Connection from all {@link #createConnection()}calls, and ignores calls to {@link com.rabbitmq.client.Connection#close()} and caches{@link com.rabbitmq.client.Channel}.
By default, only one Channel will be cached, with further requested Channels being created and disposed on demand. Consider raising the {@link #setChannelCacheSize(int) "channelCacheSize" value} in case of a high-concurrencyenvironment.
When the cache mode is {@link CacheMode#CONNECTION}, a new (or cached) connection is used for each request. In this case, no channels are cached, just connections. The intended use case is a dedicated connection for long-lived channels, such as those used in listener container threads. In those cases, the channel must be closed anyway in order to re-queue any un-acked messages.
{@link CacheMode#CONNECTION} is not compatible with a Rabbit Admin that auto-declares queues etc.
NOTE: This ConnectionFactory requires explicit closing of all Channels obtained form its shared Connection. This is the usual recommendation for native Rabbit access code anyway. However, with this ConnectionFactory, its use is mandatory in order to actually allow for Channel reuse.
@author Mark Pollack
@author Mark Fisher
@author Dave Syer
@author Gary Russell
@author Artem Bilan