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?