[rabbitmq-discuss] How to implement the Aggregator pattern?

Matthew Sackman matthew at rabbitmq.com
Fri Jun 25 13:54:09 BST 2010

Hi Shane,

On Wed, Jun 23, 2010 at 07:31:42AM -0700, Shane wrote:
> I'm trying to determine the best way to implement the Aggregator
> pattern with RabbitMQ. For example, given consumers A, B and C, I need
> to run C with the results of A and B.

If you have a consumer A and B, are you saying that they're actually
doing some transformation of the message(s), publishing that, and then C
needs to receive one message from A and one message from B before
starting any work?

If so, I suggest that A and B both publish the transformed message,
maybe via different exchanges, but that each message goes to a different
queue. C consumes from both queues, but sets qos prefetch to 1, and does
not ack any message until it has received one message from each queue.
If you want to be uber purist, you would wrap both of those acks in a
transaction to have them treated atomically.

But that's a fair guess from your original description so I might be
solving the wrong problem here!


More information about the rabbitmq-discuss mailing list