Is it possible to implement the aggregator pattern in RabbitMQ?
I have A
… N
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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With