'Declarables and MultiRabbit
I'm using spring-multirabbit library :
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
multirabbitmq:
enabled: true
connections:
my-rabbitmq:
host: localhost
port: 5677
username: guest
password: guest
How can I make sure that the "Declarables" act only on a specific rabbit connection and not on all the declared rabbits connections ?
@Bean
public Declarables queues(MessagingProperties props) {
Declaradles declarables = /* build declarables...? */
return declarables;
}
Solution 1:[1]
Ok.. I figured out how to solve it
Specify the admin with method : 'setAdminsThatShouldDeclare' on the declarable :
@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()));
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |