Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aggregator pattern in RabbitMQ

Is it possible to implement the aggregator pattern in RabbitMQ?

I have AN messages that I need to wait for/aggregate before sending off to another queue X.

So I'm thinking I will have some kind of unique ID that ensures that messages are routed exclusively to the same consumer and then wait for all the messages to arrive.

Is this possible in RabbitMQ?

like image 779
salient Avatar asked Jul 06 '17 21:07

salient


1 Answers

Yes, it is possible.

But this is not RabbitMQ specific. Understanding what to aggregate and how to do it is beyond the responsibility of the message broker.

You need to write a service to subscribe to the relevant messages and then publish the result back. In the context of RabbitMQ, you could use routing keys to ensure the right consumer gets the messages, but that is not the only way.

like image 144
istepaniuk Avatar answered Sep 29 '22 08:09

istepaniuk