← Back to team overview

txamqp-user team mailing list archive

Re: few general questions

 

Hi Jacopo

On Thu, Oct 8, 2009 at 4:56 PM, <jacopo.pecci@xxxxxxxxx> wrote:

> I recently started playing with txAMPQ and I have 5 basic questions, I hope
> someone could help me:
> I am basing my questions on Esteve’s code in http://pastebin.org/38643
>
> b) Esteve’s code works on my pc but when I try to change it to make an
> Exchange of type=”topic” (line 16) the program get stuck to this line. I
> belive I there is an error.
>
uhm, never tried sorry


> c) In Esteve’s code: doesn’t the consumer need to ack the received
> messages? Otherwise, msg would be put back in the queue after a timeout,
> isn’t it?!
>

on line 20 of http://pastebin.org/38643 there is written
yield chan.basic_consume(queue='po_box', no_ack=True, consumer_tag="testtag"
)
no_ack=True means you don't want to ack received messages (implicit ack). If
you want to explicitely ack messages set no_ack=False

e) What would be the main difference if using py-amqplib instead of txAMQP?
> I would not benefit from an asynchronous framework?! i.e. I would have to
> wait for the end of the execution of each commands like:
> chan.exchange_declare(),chan.queue_bind() and more importantly a machine
> waiting for a message would be stuck until it gets it instead of being able
> to get it asynchronously?!
>
You would lose the benefit from deferred programming. Twisted (the framework
above which txamqp is written http://www.twistedmatrix.com) allow you to
write asynchronous calls to the amqp server. With pyamqplib you have to
write your own loop to wait for the response, and the react, and then
rewait, and so on.
Twisted does all this for you, and a lot more.
I suggest you to read the introduction to twisted. You can find it here
http://twistedmatrix.com/projects/core/documentation/howto/async.html
HTH
Fabrizio

Follow ups

References