Erlang/OTP Forums

Author Message

<  RabbitMQ mailing list  ~  synchronized messages: through the queue and multiple consum

Guest
Posted: Tue Jan 15, 2008 3:23 pm Reply with quote
Guest
I have two producers that need to send synchronized message to a queue, where 1 of 3 consumers will consume the message.
tonyg
Posted: Thu Jan 17, 2008 12:04 pm Reply with quote
User Joined: 07 Nov 2006 Posts: 199
Hi Joe,

joe lee wrote:
> I have two producers that need to send synchronized message to a queue,
> where 1 of 3 consumers will consume the message. In this scenario,
> would the producer who sent the message, waits for the status back from
> the consumer, that consumed the message?

There's no provision for this kind of synchronisation embedded in AMQP,
but it's the kind of thing that's easy to construct on top of AMQP.

> In synchronized messaging,
> would producer and consumer talk directly to each other or the message
> put in queue and consumer consume and reply back to the waiting producer?

The latter - every communication is mediated by a queue.

One way you could get what I think you're after would be to have a setup
like the following diagram, where consumers get handed work items
round-robin from the queue, and each item has a queue name in the
"reply-to" field of the Basic Properties content header. When the
consumer finishes the job, it replies to the producer by inserting a
message in the reply queue found in the request, with the reply's
"correlation-id" field set equal to the "correlation-id" field of the
request. See, for example, classes RpcClient and RpcServer in the main
RabbitMQ java client library.


Producer -----------------------\
^ \
| \
|
Producer's |
reply |
queue v

^ Service exchange
|
|
| |
| |
| v
|
| Service queue
|
| |
| |
| v
| |
| /------+------\
| / | \
| | | |
| | | |
| | | |
| v v v
|
| Consumers: 1 2 3
|
\ |
\ /
\--------------------------------------


Regards,
Tony
--
[][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211
[][] LShift Ltd | Tel: +44 (0)20 7729 7060
[] [] http://www.lshift.net/ | Email: tonyg@lshift.net

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message MSN Messenger
Guest
Posted: Thu Jan 17, 2008 12:09 pm Reply with quote
Guest
Hi,

We have a detailed article about implementing this kind of stuff over
AMQP here:

http://wiki.openamq.org/tutorial:soa

It's not RabbitMQ, but as both products use AMQP, the solution should be
almost identical.

Martin

Tony Garnock-Jones wrote:
> Hi Joe,
>
> joe lee wrote:
>
>> I have two producers that need to send synchronized message to a queue,
>> where 1 of 3 consumers will consume the message. In this scenario,
>> would the producer who sent the message, waits for the status back from
>> the consumer, that consumed the message?
>>
>
> There's no provision for this kind of synchronisation embedded in AMQP,
> but it's the kind of thing that's easy to construct on top of AMQP.
>
>
>> In synchronized messaging,
>> would producer and consumer talk directly to each other or the message
>> put in queue and consumer consume and reply back to the waiting producer?
>>
>
> The latter - every communication is mediated by a queue.
>
> One way you could get what I think you're after would be to have a setup
> like the following diagram, where consumers get handed work items
> round-robin from the queue, and each item has a queue name in the
> "reply-to" field of the Basic Properties content header. When the
> consumer finishes the job, it replies to the producer by inserting a
> message in the reply queue found in the request, with the reply's
> "correlation-id" field set equal to the "correlation-id" field of the
> request. See, for example, classes RpcClient and RpcServer in the main
> RabbitMQ java client library.
>
>
> Producer -----------------------\
> ^ \
> | \
> |
> Producer's |
> reply |
> queue v
>
> ^ Service exchange
> |
> |
> | |
> | |
> | v
> |
> | Service queue
> |
> | |
> | |
> | v
> | |
> | /------+------\
> | / | \
> | | | |
> | | | |
> | | | |
> | v v v
> |
> | Consumers: 1 2 3
> |
> \ |
> \ /
> \--------------------------------------
>
>
> Regards,
> Tony
>


_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
tonyg
Posted: Thu Jan 17, 2008 12:13 pm Reply with quote
User Joined: 07 Nov 2006 Posts: 199
Martin Sustrik wrote:
> Hi,
> We have a detailed article about implementing this kind of stuff over
> AMQP here:
> http://wiki.openamq.org/tutorial:soa

That's fantastic, Martin. Thank you!

Tony
--
[][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211
[][] LShift Ltd | Tel: +44 (0)20 7729 7060
[] [] http://www.lshift.net/ | Email: tonyg@lshift.net

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message MSN Messenger
Guest
Posted: Tue Jan 22, 2008 12:10 pm Reply with quote
Guest
Martin,

Qpid python or RabbitMQ java client compatible with OpenAMQ?
tonyg
Posted: Wed Jan 30, 2008 1:37 pm Reply with quote
User Joined: 07 Nov 2006 Posts: 199
Hi Joe,

Sorry for the delay in getting back to you. How are you getting on with
AMQP?

joe lee wrote:
> Qpid python or RabbitMQ java client compatible with OpenAMQ? I must
> say, I am impressed with the documentation. Very nice. I am
> downloading as of now and will give it a try.

OpenAMQ speaks AMQP 0-9, where the RabbitMQ broker alas currently only
speaks AMQP 0-8, as does our Java client. The QPid python client
probably can be made to speak to OpenAMQ as well as RabbitMQ.

Our new .NET client, however, is runtime-switchable between 0-8 and 0-9
protocol variants, and we've used it successfully to talk to OpenAMQ
1.2c4 as well as RabbitMQ 1.2.x. Of course, using .NET may not be an
option for you.

(Aside: Mono's implementation is really pretty good. I found myself able
to "write once, run anywhere" AMQP programs using Mono or MS's CLR. The
code ran unmodified on Mac OS X 10.3.9, OS X 10.5, Debian Linux, and
Windows Server 2003...)

Regards,
Tony
--
[][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211
[][] LShift Ltd | Tel: +44 (0)20 7729 7060
[] [] http://www.lshift.net/ | Email: tonyg@lshift.net

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message MSN Messenger

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum