views:

147

answers:

1

I'd like to make sure that my message was delivered to a queue.

To do so I'm adding the mandatory param to the basic_publish. What else should I do to receive the basic.return message if my message wasn't successfully delivered?

I can't use channel.wait() to listen for the basic.return because when my message is successfully delivered the wait() function hangs forever. (There is no timeout) On the other hand. When I don't call channel.wait() the channel.returned_messages will remain empty, even if the message isn't delivered.

I use py-amqplib version 0.6.

Any solution is welcome.

A: 

It is currently impossible as the basic.return is sent asynchronously when a message is dropped in broker. When message was sent successfully no data is reported from server. So pyAMQP can't listen for such messages.

I've read few threads about this problem. Possible solution were:

  • use txAMQP, twisted version of amqp that handles basic.return
  • use pyAMQP with wait with timeout. (I'm not sure if that is currently possible)
  • ping server frequently with synchronous commands so that pyAMQP will able to pick basic.return messages when they arrive.

Because the level of support for pyAMQP and rabbitMQ in general is quite low, we decided not to use amqp broker at all.

Piotr Czapla