← Back to team overview

txamqp-user team mailing list archive

Re: few general questions

 

Hi,

sorry for the slow reply, I just moved to Mexico from Spain and I'm
still figuring out where I am, apart from recovering from jetlag :-)

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
>
> a) Important classes like ChannelAmqp80 are created on the fly from the xml
> file (at least that’s my understanding). This is making my life difficult: I
> cannot read the code and cannot call help() on the methods. Is there an easy
> way to access this information? (now I am calling the
> help(chan.basic_publish) from my code i.e. in def gotConnection())

Actually, there's nothing in the generated methods apart from a call
to AMQChannel#invoke, which takes a method, arguments for the method
and an optional content argument. IIRC, there's a ticket somewhere in
Launchpad for implementing static generation, but it's not a priority,
although patches will be very welcome :-)

Anyway, you can call help on the spec methods:

from txamqp import spec
s = spec.load(PATH_TO_SPEC)
help(s.klass.queue_declare)

> 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.

That's weird, which broker are you using? In any case, there's a test
for topic exchanges in the testsuite
(test/test_exchange.py#RecommendedTypesRuleTests#testTopic). Make sure
you're passing the right arguments.

> 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?!

As Fabrizio already pointed out, it's not needed if the consumer is
declared with no_ack argument set to True.

> d) In general, what is the point of having multiple channels on the same
> connections (I believe on a single channel I may still have more than one
> Exchange)?

That's part of the AMQP standard, so there's few I can do :-) There's
been some discussion to remove that feature from the standard, but
there's a use case where it may be useful. IIRC, I don't remember the
details, but if you have a router that implements QoS, it's far easier
to manage AMQP traffic if there's only one connection and multiple
channels, and AMQP takes care of de/multiplex them.

> 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?!

Matt Heitzenroder wrote an excelent article a while ago about the
importance of using Twisted (and txAMQP), he summarized it perfectly
here:

http://www.apparatusproject.org/blog/2009/04/creating-a-simple-amqp-client-using-txamqp/

> Thanks in adavance,

Thank you for using txAMQP :-)

Cheers.



References