I have a setup of multiple queues to distribute different types of memory and time intensive tasks to workers.
While the worker instances are intended to listen to different subsets of the queues, they should only consume a limited amount of messages (usually 1) at a time per worker to prevent them from running out of memory. We are using a SimpleMessageListenerContainer for the queues with a concurrency and prefetch count of e.g. 1.
The problem is that the prefetch count seems to be set on the channel with the global option set to false, so it is not applied per channel, but per consumer / queue (see docs).
As a result, a single worker that processes a long running task blocks a message on every queue it listens to, while the other workers idle.
Because of the requirement that the workers can be configured for changing subsets of task types, we cannot route all tasks to a single queue or worker specific ones.
I couldn't find a way to change the qos setting on the channel before the consumers are subscribed, because everything happens within the start method of the BlockingQueueConsumer.