[rabbitmq-discuss] RabbitMQ Usage Patterms?
csharpplusproject
csharpplusproject at gmail.com
Tue Jul 19 03:31:50 BST 2011
Simone,
Thank you for your explanation, although I do not really understand how
this works.
You write: "...listening for messages arriving from RabbitMQ and
dispatching them to your application."
I have no problem writing code that is "...listening for messages
arriving from RabbitMQ". The question is, how do I dispatch these
messages to my application while letting the application run
continuously with no interruptions?
Can anybody provide sample code in python that demonstrates such a
pattern? Thanks.
-----Original Message-----
From: Simone Busoli <simone.busoli at gmail.com>
To: Shalom Rav <csharpplusproject at gmail.com>
Cc: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] RabbitMQ Usage Patterms?
Date: Tue, 19 Jul 2011 01:51:16 +0200
A common way to go is to have a thread - or whathever your environment
calls it - running in parallel to your application code, listening for
messages arriving from RabbitMQ and dispatching them to your
application.
On Jul 19, 2011 1:45 AM, "Shalom Rav" <csharpplusproject at gmail.com>
wrote:
> I have gone through the 'Get Started' examples on the RabbitMQ
> website.
>
> 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?
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110718/77437f61/attachment.htm>
More information about the rabbitmq-discuss
mailing list