Everything is described clearly in the Reference Manual:
The AMQP specification describes how the protocol can be used to configure Queues, Exchanges and Bindings on the broker. These operations which are portable from the 0.8 specification and higher are present in the AmqpAdmin interface in the org.springframework.amqp.core package.
And further:
When the CachingConnectionFactory cache mode is CHANNEL (the default), the RabbitAdmin implementation does automatic lazy declaration of Queues, Exchanges and Bindings declared in the same ApplicationContext.
So, you should declare Queue
, Exchange
and Binding
beans in your application context and AmqpAdmin
will take care about their definition on the target Broker.
There must be a note that according AMQP protocol, if entity already exists on the Broker, the declaration is just silent and idempotent.
So, in your case you don't need to worry about queues existence and just provide their declarations as beans in the application context.