Functionally equivalent amqp_publisher and amqp_consumer

Asked by Dan Di Spaltro

Hey guys, I am reading the blog post here http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens//basic/tx and am trying to mimick the same thing with the two different producers and consumers, one being Esteve's and one being the other python library. The most basic function is not working, for example if I invoke the producer and add a loop to send the message 10000, with the format "hello %d" then I should be able to run the consumer 10000 times seeing

hello 1
hello 2

But instead I get this

$ python txamqp_consumer.py amqp0-8.xml
Received: hello '1' from channel #1
$ python txamqp_consumer.py amqp0-8.xml
Received: hello '165' from channel #1
$ python txamqp_consumer.py amqp0-8.xml
Received: hello '569' from channel #1

So I am not sure what is going on here, I am fairly new to Twisted so I am not too comfortable with this stuff yet, but this seems like incorrect behavior.

Question information

Language:
English Edit question
Status:
Solved
For:
txAMQP Edit question
Assignee:
No assignee Edit question
Solved by:
Esteve Fernandez
Solved:
Last query:
Last reply:
Revision history for this message
Best Esteve Fernandez (esteve) said :
#1

Actually it's correct. All messages are delivered to the consumer's internal queue, but since the reactor stops after the first message is popped off the queue, the other ones are not printed.

Anyway, I've uploaded a newer version of the consumer script at the same location. I didn't notice that Jason's script had an infinite loop, which waited indefinitely for messages. I've tested a similar scenario as yours (py-amqplib publish + txamqp consumer) and it works. Let me know if it works for you as well.

Revision history for this message
Dan Di Spaltro (dan-dispaltro) said :
#2

I kinda realized that after the fact, regardless thank you for the answer! Your quick responses are always appreciated!

Revision history for this message
Dan Di Spaltro (dan-dispaltro) said :
#3

Thanks esteve, that solved my question.