I am looking for a message queue with an in-built throttling feature. Use case is that the recipient worker pool may accept a lot of messages but a service that workers depend on may not be able to handle the load. It's not possible to reduce the worker pool since the worker instances handle different types of messages.
So the feature I am looking for is throttling based on a topic. Say a topic T
, I want the queue to accept as many messages from the producers, but throttle the demand from consumers on topic T
to say deliver only 5 messages per minute.
For Java following solutions may work, They should be also available for node
poll()
calls.Try to sleep thread between call to
poll()
Try to use more timeout in
poll()
and use following propertyMAX_POLL_RECORDS_CONFIG
to control how many messages you willreceive in a single poll.