Let's say that I have a pipeline of commands that need to be executed sequentially and that some of the commands contain multiple operations that should be executed in parallel (same correlation id). And let's assume that I need to know when all parallel operations are executed in order to proceed with execution further in the pipeline.
Is it possible to achieve this kind of orchestration with RabbitMQ alone by using exchanges and queues without usage of external data sources like database ?
I am interested in the following use case: I have just published 3 messages of the same type on the same queue. Those messages are being processed in parallel. I would like to publish a new message only when all messages of the same correlation ID are finished successfully.
Is there a way to achieve this with RabbitMQ ?Answer1:
It sounds like you could use the scatter-gather pattern. This explains that pattern quite well with a diagram:
<a href="http://www.enterpriseintegrationpatterns.com/patterns/messaging/BroadcastAggregate.html" rel="nofollow">http://www.enterpriseintegrationpatterns.com/patterns/messaging/BroadcastAggregate.html</a>
And here is a tutorial on how to implement with RabbitMQ: <a href="http://geekswithblogs.net/michaelstephenson/archive/2012/08/06/150373.aspx" rel="nofollow">http://geekswithblogs.net/michaelstephenson/archive/2012/08/06/150373.aspx</a>