I have one producer, one queue and N consumers. Producer creates 'jobs' to be performed by consumers. I'd like to use pull model, in which consumer pulls job from queue, when it finishes the previous job, not push model with round robin, where jobs are divided by equal to consumers.
My consumers use the same code, but when I ran it, the first one connects and receives all jobs. Even when looking at it in debug, the first gets everything but the second etc do not get any message (even when it executes receive before first one executes receive which returns it some jobs).
Connection URL: "amqp://guest:guest@prodconstest/?brokerlist='tcp://127.0.0.1:5767'"
Code for every consumer does:
"ADDR:" + queueName + "; {create: always, link:{x-subscribes: {exclusive: false}}}"
Is it theoretically possible to achive using AMQP queue? If so, how?
It seems that I have to change maxprefetch
parameter in connection URL. Default value 5000 is too big for my use case, changing it to 1 makes this system work.