[rabbitmq-discuss] Help tracking down disconnection locations in code

Simon MacMullen simon at rabbitmq.com
Fri May 13 12:21:32 BST 2011


On 12/05/11 18:12, Gavin M. Roy wrote:
> I am looking to enumerate in Pika the places or reasons that RabbitMQ
> may disconnect the client connection. There's the case of bad
> credentials and permission issues with the vhost for example. Is there a
> common module/function called within the RabbitMQ source to handle these
> types of disconnects?

In pretty much every case an #amqp_error{} record will be constructed, 
then thrown as an exception. #amqp_error{} is in general constructed and 
thrown by a call to rabbit_misc:protocol_error(), so that's probably the 
best thing to look for.

Note that some AMQP exceptions lead to connections being disconnected 
("hard" errors) while some lead to channels being disconnected ("soft" 
errors). Both go through rabbit_misc:protocol_error(). The 0-9-1 XML 
spec lists which are which (under "CONSTANTS", near the top).

Can I ask why you want to know though? In general the spec document 
lists the error codes that can occur, and each error should be 
accompanied by a descriptive text. The only exception is for errors that 
happen while the connection is being established (is that what you're 
asking about? - in which case I think it's permissions as you already 
know, framing errors and internal errors.)

Cheers, Simon

-- 
Simon MacMullen
Staff Engineer, RabbitMQ
SpringSource, a division of VMware



More information about the rabbitmq-discuss mailing list