<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
Simone,<BR>
<BR>
Thank you for your explanation, although I do not really understand how this works. <BR>
<BR>
You write: <B>"...listening for messages arriving from RabbitMQ and dispatching them to your application."</B><BR>
<BR>
I have no problem writing code that is <B>"...listening for messages arriving from RabbitMQ</B>". The question is, how do I <I>dispatch</I> these messages to my application <FONT COLOR="#800080">while letting the application run continuously with no interruptions</FONT>?<BR>
<BR>
Can anybody provide sample code in <FONT COLOR="#0000ff">python</FONT> that demonstrates such a pattern? Thanks.<BR>
<BR>
-----Original Message-----<BR>
<B>From</B>: Simone Busoli <<A HREF="mailto:Simone%20Busoli%20%3csimone.busoli@gmail.com%3e">simone.busoli@gmail.com</A>><BR>
<B>To</B>: Shalom Rav <<A HREF="mailto:Shalom%20Rav%20%3ccsharpplusproject@gmail.com%3e">csharpplusproject@gmail.com</A>><BR>
<B>Cc</B>: <A HREF="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</A><BR>
<B>Subject</B>: Re: [rabbitmq-discuss] RabbitMQ Usage Patterms?<BR>
<B>Date</B>: Tue, 19 Jul 2011 01:51:16 +0200<BR>
<BR>
<BR>
<BR>
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.<BR>
<BR>
On Jul 19, 2011 1:45 AM, "Shalom Rav" <<A HREF="mailto:csharpplusproject@gmail.com">csharpplusproject@gmail.com</A>> wrote:<BR>
> I have gone through the 'Get Started' examples on the RabbitMQ<BR>
> website.<BR>
> <BR>
> While the examples are good, it looks like they are all similar --<BR>
> having the 'app' part of the code (a function call, a task etc)<BR>
> *embedded* within the messages consumer.<BR>
> <BR>
> In other words, using *channel.start_consuming()* we continuously WAIT<BR>
> for messages to arrive; As soon as a message is consumed (--> *** in<BR>
> response to the message's consumption *** <--) we do something (this<BR>
> is the 'app').<BR>
> <BR>
> This pattern is basically having the 'app' *embedded* within the<BR>
> consumer. An 'app' will ONLY work in response to a message that was<BR>
> being consumed.<BR>
> ___________________________________________________________<BR>
> <BR>
> What about the other way around -- can we have the messages *embedded*<BR>
> within an 'app'?<BR>
> <BR>
> In other words, is it possible to simply code up our app (say, a<BR>
> class) in the usual way, and, whenever we want to receive a message,<BR>
> simply include that code where we want to?<BR>
> <BR>
> In such a scenario, our script will spend most of its time running our<BR>
> app. When a certain condition is met (and ONLY then), we will invoke a<BR>
> call to rabbitMQ to receive a message from a queue.<BR>
> <BR>
> Does it make sense? Are there any python code samples that<BR>
> demonstrate this approach?<BR>
> _______________________________________________<BR>
> rabbitmq-discuss mailing list<BR>
> <A HREF="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</A><BR>
> <A HREF="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</A><BR>
<BR>
<BR>
</BODY>
</HTML>