0
votes

We have an existing project where RabbitMQ exchanges were previously declared in the Spring XML config file. Now the company Rabbit setup has changed so that exchanges are declared in another project and our project should just publish to a queue in the already declared exchange.

The old configuration causes the following exception:

2015-02-03 13:10:35,374 ERROR [pool-12-thread-1] [CachingConnectionFactory] [] - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - cannot redeclare exchange 'exchange.something' in vhost 'something' with different type, durable, internal or autodelete value, class-id=40, method-id=10)
2015-02-03 13:10:35,383 ERROR [pool-10-thread-1] [MqPublishService] [] - Sending message to MQ failed. Retrying in next batch job.

Is there any way to avoid declaring the exchange when using the Spring and Amqp xml configuration option?

1

1 Answers

0
votes

Actually there is no need to declare them at all. For client application it's just enough to know exchange and queue names and, of course, routing keys.

From other side, if your application is based on those beans (<queue>, <exchange> etc.), you just need to remove <admin>. Only AmqpAdmin is responsible to declare those entities on the Broker.