Do not create create a new ConnectionFactory if one already exists in parent
Fix #63 Make sure that the creation of a new `ConnectionFactory` when cloud connectors are used is done only when the binder context is not a child of the main context, otherwise inherit the connection factory as in normal case. This ensures that its lifecycle is in sync with the parent.
This commit is contained in:
committed by
Gary Russell
parent
964339c4fe
commit
80294c4acc
@@ -91,6 +91,7 @@ public class RabbitServiceAutoConfiguration {
|
||||
* @return the {@link ConnectionFactory} used by the binder.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(ConnectionFactory.class)
|
||||
ConnectionFactory rabbitConnectionFactory(Cloud cloud) {
|
||||
return cloud.getSingletonServiceConnector(ConnectionFactory.class, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user