[rabbitmq-discuss] How to catch RESOURCE_LOCKED exceptions in erlang client

Geib, Mark Mark.Geib at echostar.com
Thu Aug 15 23:28:12 BST 2013

I am trying to use the feature of creating exclusive queues in order to limit consumers to "one at a time" for given messages but can not see how to catch the exception I receive when the second consumer tries to declare the same queue. Everything is working as excepted but I am not sure how to prevent my gen_server from terminating. I want to catch the event, then retry, to provide a "backup" consumer.

In my log file I see:
16:18:59.011 [error] CRASH REPORT Process 'amqp_worker_con_2:1' with 0 neighbours exited with reason: {{shutdown,{server_initiated_close,405,<<"RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'q1' in vhost '/'">>}},{gen_server,call,[<0.101.0>,{call,{'queue.declare',0,<<"q1">>,false,false,true,true,false,[]},none,<0.66.0>},infinity]}} in gen_server:terminate/6 line 744

Thanks for any help,

Mark Geib
Principal Engineer
Cheyenne Software Engineering
mark.geib at echostar.com / 35-215

“We, the unwilling, led by the unknowing, are doing the impossible for the ungrateful. We have done so much, for so long, with so little, we are now qualified to do anything with nothing.” 
― Mother Teresa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130815/1cdb79a3/attachment.pgp>

More information about the rabbitmq-discuss mailing list