I have an anonymous and exclusive queue defined like this:
@Bean
public SimpleMessageListenerContainer responseMessageListenerContainer(){
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(simpleRoutingConnectionFactory());
container.setQueues(responseAnonymousQueue());
container.setMessageListener(rabbitTemplate());
container.setAcknowledgeMode(AcknowledgeMode.AUTO);
container.setMessageConverter(jsonMessageConverter());
return container;
}
@Bean
public Queue responseAnonymousQueue() {
return new MyAnonymousQueue();
}
Sometimes I get this error en rabbitmq log:
=ERROR REPORT==== 12-Apr-2016::15:13:42 === Channel error on connection <0.6899.0> (XX.XXX.57.174:51716 -> 192.168.100.145:5671, vhost: '/', user: 'XXXX_USER'), channel 1: {amqp_error,resource_locked, "cannot obtain exclusive access to locked queue ' XXXX_USER-broad-1457bb43-6487-4252-b21a-a5a92d19e0dc' in vhost '/'", 'queue.declare'}
So the client can’t declare the queue and it can’t receive the messages from the AMQP server.
It happens after this message:
=WARNING REPORT==== 12-Apr-2016::15:11:51 === closing AMQP connection <0.6810.0> (XX.XXX.57.174:17959 -> 192.168.100.145:5671): connection_closed_abruptly
=INFO REPORT==== 12-Apr-2016::15:13:41 === accepting AMQP connection <0.6899.0> (XX.XXX.57.174:51716 -> 192.168.100.145:5671)
I can’t reproduce it (I have tried closing the connection from rabbitmq and removing the network cable, but the application reconnect well again), so I don’t know exactly why is this happening. It is supposed that private and exclusive queues are deleted with the closing of the connection, so why is this happening? How can I catch this exception and recover from it?
Thanks