[rabbitmq-discuss] synchronized messages: through the queue and multiple consumers
Martin Sustrik
sustrik at imatix.com
Thu Jan 17 12:08:59 GMT 2008
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
>
More information about the rabbitmq-discuss
mailing list