I have requests coming in for different samples (s1, s2, ..) that need to be processed in a linear fashion (i.e. only one say s1-request at the time can be processed). I have N-number of worker services that can process given requests. How can I implement rpc-queue pattern so that the samples are consumed one at the time and still allow distribution of calculation between different samples?
I would like to implement this with rabbit-mq because of it's simplicity, clustering capabilities, but I'm willing to consider other solutions as well.
Here is a picture to illustrate the problem ( with two workers)
worker 1
+-----------+
| |
input queue +---->| |-------+
+--------------+ | | | |
| | | +-----------+ |
| s1,s2,s1,s1 |------+ |
| | | worker 2 |
+--------------+ | +-----------+ |
| | | |
output queue +---->| |-------+
+--------------+ | | |
| | +-----------+ |
|(s1,s2,s1,s1) |<-+ |
| | +-----------------------------+
+--------------+