Revert previous commit

This reverts commit ca09dfa6d2.

Add important note to the docs about `RabbitAdmin` and exclusive queues.
This commit is contained in:
Gary Russell
2018-05-11 13:58:38 -04:00
committed by Artem Bilan
parent ca09dfa6d2
commit acd2e58065
3 changed files with 10 additions and 10 deletions

View File

@@ -244,7 +244,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
private boolean userCorrelationId;
private boolean usePublisherConnection = true;
private boolean usePublisherConnection;
/**
* Convenient constructor for use with setter injection. Don't forget to set the connection factory.

View File

@@ -1069,12 +1069,17 @@ Examples:
The first example is a literal expression; the second obtains the `username` property from a connection factory bean in the application context.
[[separate-connection]]
===== Using a Separate Connection for RabbitTemplate and Consumers
===== Using a Separate Connection
Starting with _version 2.1_, the `RabbitTemplate` `usePublisherConnection` property is true by default to avoid consumers being blocked when a producer is blocked for any reason.
The `CachingConnectionFactory` maintains a second internal connection factory for this purpose.
Starting with _version 2.0.2_, set the `usePublisherConnection` property to `true` to use a different connection to that used by listener containers, when possible.
This is to avoid consumers being blocked when a producer is blocked for any reason.
The `CachingConnectionFactory` now maintains a second internal connection factory for this purpose.
If the rabbit template is running in a transaction started by the listener container, the container's channel is used, regardless of this setting.
To revert to the previous behavior of using the same connection as listener containers, set the template's property to `false`.
IMPORTANT: In general, you should not use a `RabbitAdmin` with a template that has this set to true.
Use the `RabbitAdmin` constructor that takes a connection factory; if you use the other constructor that takes a template, ensure the template's property is false.
This is because, often, an admin is used to declare queues for listener containers; using a template that has the property set to true would mean that exclusive queues (such as `AnonymousQueue`) would be declared on a different connection to that used by listener containers.
In that case, the queues cannot be used by the containers.
[[sending-messages]]
==== Sending messages

View File

@@ -18,8 +18,3 @@ RabbitMQ `ConnectionFactory` instances created by the `RabbitConnectionFactoryBe
Certain classes have moved to different packages; most are internal classes and won't affect user applications.
Two exceptions are `ChannelAwareMessageListener` and `RabbitListenerErrorHandler`; these interfaces are now in `org.springframework.amqp.rabbit.listener.api`.
===== RabbitTemplate Changes
The `RabbitTemplate` now sets `usePublisherConnection` to `true` by default.
See <<separate-connection>> for more information.