[rabbitmq-discuss] Return message? [Was: Re: Sample code for python?]

Valentino Volonghi dialtone at gmail.com
Mon Jul 6 19:36:45 BST 2009


On Jul 6, 2009, at 8:54 AM, Allen Fowler wrote:

> I am not at all familiar with the twisted system, but does this mean  
> that RabbitMQ/AMQP does not, on it's own, provide any method for a  
> message sender to ascertain the success or failure of a task  
> embodied by a message?

Twisted Matrix is just an event driven networking framework. You
don't really need to know it to use quebert unless you want to implement
extra functionality in it (but even in that case you need to know only a
small part of it).

> That is to say: The backed system (job receiver) has no way of  
> signaling to the front-end (job-sender) any details about the job  
> the front-end is waiting on?

> Is this true?


Why do you need asynchronous guaranteed delivery when you want to
receive a synchronous result?

If your plan is to simply execute a task and know the outcome then  
simply
run an HTTP request to the service that runs it and if it fails you  
know it.

If you are looking for asynchronous execution then, no matter what  
system
you use, you'll have to come up with an alternative way to send the  
result
to the caller (which could even be dead when the task finishes).

RabbitMQ provides you guaranteed delivery of a message by taking
responsibility when you send the payload through it. Then it's queued  
and
the way you handle it in the consumer gives your communication channel
a subset (full or partial) of the properties that rabbitmq guarantees.  
Keep in
mind though that if the task executor is not online when you request a  
task
your search for a synchronous result would essentially be hanging  
forever.

Using HTTP between the consumer and the execution channel you are
using HTTP properties to know when a task executes or not. If the  
request
returns a 200 OK then it was completed and the result might be in the  
returned
response or saved in another storage that something else might poll  
while
in the response there might be the unique key or URI to get to that  
payload.

I believe that IMHO you are mixing some unrelated problems, one is
asynchronous execution of tasks and the other is "returning" a result,  
to
do the second one you need to create your own system (carrot, which is
the base for celery, provides a built-in system where the result is  
stored
in a key-value store or again in rabbitmq where the original producer  
waits
for it, IMHO this is not how I would do it, the task should be  
autocontained
and should do everything in itself, the "frontend" (producer) should  
just
access data normally and look for the result where it would normally, if
you actually need a result then your infrastructure should give you a  
way
to use the systems both synchronously and asynchronously in the simplest
way possible, and an HTTP request without going through RabbitMQ is
the simplest way possible when you need a result).


--
Valentino Volonghi aka Dialtone
Now running MacOS X 10.5
Home Page: http://www.twisted.it
http://www.adroll.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090706/8be78c85/attachment.pgp 


More information about the rabbitmq-discuss mailing list