Spring 具有两个 ConnectionFactory 的 AMQP
Spring AMQP with two ConnectionFactory
我有一个包含两个 ConnectionFactory(不同代理)的应用程序。它们配置为 java 类:
@Bean
public ConnectionFactory ...
@Bean
public Queue ...
...
在 rabbittemplate 中你可以指示连接,但不能在队列或交换中指示,所以它们是在两个连接中创建的。
我是否必须使用 RabbitAdmin 仅在两个连接之一中创建队列?还有其他办法吗?
参见the documentation : Conditional Declaration。
Starting with the 1.2 release, it is possible to conditionally declare these elements. This is particularly useful when an application connects to multiple brokers and needs to specify with which broker(s) a particular element should be declared.
每个连接工厂都需要一个 RabbitAdmin
,并使用 declared-by
指示哪个管理员应该声明每个 queue/exchange/binding。
我有一个包含两个 ConnectionFactory(不同代理)的应用程序。它们配置为 java 类:
@Bean
public ConnectionFactory ...
@Bean
public Queue ...
...
在 rabbittemplate 中你可以指示连接,但不能在队列或交换中指示,所以它们是在两个连接中创建的。 我是否必须使用 RabbitAdmin 仅在两个连接之一中创建队列?还有其他办法吗?
参见the documentation : Conditional Declaration。
Starting with the 1.2 release, it is possible to conditionally declare these elements. This is particularly useful when an application connects to multiple brokers and needs to specify with which broker(s) a particular element should be declared.
每个连接工厂都需要一个 RabbitAdmin
,并使用 declared-by
指示哪个管理员应该声明每个 queue/exchange/binding。