声明和 MultiRabbit
Declarables and MultiRabbit
我正在使用 spring-multirabbit 库:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
multirabbitmq:
enabled: true
connections:
my-rabbitmq:
host: localhost
port: 5677
username: guest
password: guest
如何确保“可声明”仅作用于特定的 rabbit 连接而不作用于所有已声明的 rabbits 连接?
@Bean
public Declarables queues(MessagingProperties props) {
Declaradles declarables = /* build declarables...? */
return declarables;
}
好的..我想出了解决办法
使用方法指定管理员:'setAdminsThatShouldDeclare' 在可声明的:
@Bean
public Declarables queues(MessagingProperties messagingProperties) {
return new Declarables(messagingProperties.getBindings().stream().map(b ->
{
Declarable queue = QueueBuilder.nonDurable(b.getQueue()).build();
queue.setAdminsThatShouldDeclare("my-rabbitmq-admin");
return queue;
}).collect(Collectors.toList()));
}
我正在使用 spring-multirabbit 库:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
multirabbitmq:
enabled: true
connections:
my-rabbitmq:
host: localhost
port: 5677
username: guest
password: guest
如何确保“可声明”仅作用于特定的 rabbit 连接而不作用于所有已声明的 rabbits 连接?
@Bean
public Declarables queues(MessagingProperties props) {
Declaradles declarables = /* build declarables...? */
return declarables;
}
好的..我想出了解决办法
使用方法指定管理员:'setAdminsThatShouldDeclare' 在可声明的:
@Bean
public Declarables queues(MessagingProperties messagingProperties) {
return new Declarables(messagingProperties.getBindings().stream().map(b ->
{
Declarable queue = QueueBuilder.nonDurable(b.getQueue()).build();
queue.setAdminsThatShouldDeclare("my-rabbitmq-admin");
return queue;
}).collect(Collectors.toList()));
}