1

If I declare a queue with x-max-length, all messages will be dropped or dead-lettered once the limit is reached.

I'm wondering if instead of dropped or dead-lettered, RabbitMQ could activate the Flow Control mechanism like the Memory/Disk watermarks. The reason is because I want to preserve the message order (when submitting; FIFO behaviour) and would be much more convenient slowing down the producers.

joao cenoura
  • 1,155
  • 2
  • 14
  • 20

2 Answers2

0

Try to realize queue length limit on application level. Say, increment/decrement Redis key and check it max value. It might be not so accurate as native RabbitMQ mechanism but it works pretty good on separate queue/exchange without affecting other ones on the same broker.

P.S. Alternatively, in some tasks RabbitMQ is not the best choice and old-school relational databases (MySQL, PostgreSQL or whatever you like) works the best, but RabbitMQ still can be used as an event bus.

pinepain
  • 12,453
  • 3
  • 60
  • 65
  • Yes I'm aware I can throttle on application level (with [channel.flow()](https://www.rabbitmq.com/amqp-0-9-1-reference.html#channel.flow) for instance). Although I was looking if RabbitMQ already implemented such mechanism in the broker itself. – joao cenoura Apr 16 '14 at 14:52
  • Note, that RabbitMQ has limited `channel.flow` support https://www.rabbitmq.com/specification.html#method-status-channel.flow. In fact server does not support blocking flow with `active=true`. – pinepain Apr 16 '14 at 15:11
  • And `channel.flow` works on channel level, so looks like it is not an option for you anyway. – pinepain Apr 16 '14 at 15:15
0

There are two open issues related to this topic on the rabbitmq-server github repo. I recommended expressing your interest there:

Block publishers when queue length limit is reached

Nack messages that cannot be deposited to all queues due to max length reached

chadrik
  • 3,413
  • 1
  • 21
  • 19