Dynamic binding ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Dynamic binding ?

This post has NOT been accepted by the mailing list yet.
This post was updated on .
I am looking to use RabbitMQ for consuming messages across a bunch of services.  The messages are for an order and have an OrderID and there will be many messages for an orderId. The messages for a particular order have to be processed in sequence.
I would like the services to not have any affinity in general and can service any message for any order unless another services is processing a previous message with that key.
Say for Example O1, O2,O3, O2, O4 are successive messages for order 1,2 ,3,4 and say i have say 5 services.  the first O1 can go to serviceInstance-1, O2 to serviceInstance-2, O3 to serviceInstance-3, but the next O2, I dont want it to be picked up as there is unacked message for O2 being serviced by ServiceInstance2 and hence ServiceInstance-4 will pick up O4.

Having read documentation of rabbitMQ, I figured binding is an option so O2 messages goes to a O2 queue and waits for previous message to be ACKED. But since the orderIds are dynamic, I cannot create a Queue binding with that on startup of client and have to do it dynamically.
So i have a couple of questions
1. In my example above, can service 2 set up dynamically a new binding for O2 that prevents any more messages of O2 being available to Any other service? Even if i am able to do that , can i divert existing messages of O2 to this new queue from the master Queue?

IS there a better way to solve this problem?