[rabbitmq-discuss] RabbitMQ Usage Patterms?

Shalom Rav csharpplusproject at gmail.com
Tue Jul 19 00:44:31 BST 2011

I have gone through the 'Get Started' examples on the RabbitMQ

While the examples are good, it looks like they are all similar --
having the 'app' part of the code (a function call, a task etc)
*embedded* within the messages consumer.

In other words, using *channel.start_consuming()* we continuously WAIT
for messages to arrive; As soon as a message is consumed (--> *** in
response to the message's consumption *** <--) we do something (this
is the 'app').

This pattern is basically having the 'app' *embedded* within the
consumer. An 'app' will ONLY work in response to a message that was
being consumed.

What about the other way around -- can we have the messages *embedded*
within an 'app'?

In other words, is it possible to simply code up our app (say, a
class) in the usual way, and, whenever we want to receive a message,
simply include that code where we want to?

In such a scenario, our script will spend most of its time running our
app. When a certain condition is met (and ONLY then), we will invoke a
call to rabbitMQ to receive a message from a queue.

Does it make sense?  Are there any python code samples that
demonstrate this approach?

More information about the rabbitmq-discuss mailing list