Reputation: 2166
I have a Spring-Boot app containing many @Service components for handling event-typed AMQP messages. These messages are published by another component to a single ExchangeTopic separated by routing-keys.
How should I create and subscribe the Queues to the TopicExchange once the application starts and avoid maintaining a massive configuration?
Upvotes: 0
Views: 27
Reputation: 174574
You can simply invoke RabbitAdmin.declareQueue()
and declareBinding()
as needed.
For each new queue, you can either create a new SimpleMessageListenerContainer
or add the queue to an existing container.
Adding queues to a container cancels the existing consumers and immediately creates new ones so there is a (short) interruption.
Upvotes: 3