Code review comment for lp:~djfroofy/txamqp/txamqp-return-handling

Revision history for this message
Drew Smathers (djfroofy) wrote :

Hi Esteve,

I've looked into implementing DeferredQueue for set_return_handler instead of synchronous callbacks and has a few basic questions. For one, from my understanding the AMQClient.queues is specifically for consumer queues and nothing else, right? If I'm right I assume I would need to segregate returns from deliveries.

Secondly, can you provide a minimal example showing what you think is the best API is for handling basic.return. For example something along the lines of the following for basic.consumer to delivery:

  reply = yield channel.basic_consume(queue="test-queue", no_ack=True)
  queue = yield self.client.queue(reply.consumer_tag)
  msg = yield queue.get(timeout=1)

My guess is the interface might put the responsibility on invoking callbacks on the user, so we'd have something like:

  @inlineCallbacks
  def return_checker():
    queue = yield self.client.return_queue()
    (ch, return_msg) = yield queue.get(timeout=1)
    ... do something with message

  checker = LoopingCall(return_checker)
  checker.start(5)

  ...

Then we'd remove set_return_handler?

Please let me know if this is what you're considering.

Thanks.

« Back to merge proposal