How to detect when publishing a message on a channel where the server has "gone away"

Asked by Kevin Shuk

I've got a workflow where I'm pulling a query message off an incoming queue, processing it locally and building a response message, publishing that response to an outgoing queue (well, basic publish to an exchange with a routing key - the actual queue(s) binding will be defined by the consumer), and finally acknowledging the incoming message that I just responded to in order to dequeue it.

The local processing takes a while - several seconds - and in that time, I've shut down the rabbitMQ server used for both in and out queues to simulate an outage. However, when the response is ready and my code publishes it, basic_publish to my channel seems to happily toss the response into the void with no error that I have detected.

I'm using inlineCallbacks and yield-ing my basic_publish call. The return value is None whether the MQ server is up or down. Is there a way to detect that I'm publishing to nowhere when the server isn't present so that I can start attempting to reconnect to the server when it returns?

Many thanks...

Question information

English Edit question
txAMQP Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Esteve Fernandez (esteve) said :

Hi Kevin.

This should be fixed by implementing AMQClient#connectionLost, I'll file an issue.

BTW, the reason basic_publish yields None is that, although the outgoing queue checks if it's closed, the AMQClient#close is never called if the connection to the broker is gone.


Can you help with this problem?

Provide an answer of your own, or ask Kevin Shuk for more information if necessary.

To post a message you must log in.