Debugging policies in RabbitMQ

April 30, 20252 min read

Debugging policies in RabbitMQ

The right tool for the job

While the rules that RabbitMQ applies to choose which policy to apply to a queue are known, it can be cumbersome to debug and try to understand exactly which policy is applied and why. You can use the management plugin to go back and forth between the policies and the queues, but it is not very convenient. In this article we are going to use RabbitGUI to debug policies in RabbitMQ much faster.

How to know if a policy is applied to a queue?

Open RabbitGUI and go to the queue you are interested in. In the "Settings" tab you should see a "Policy" section indicating if the queue has a policy applied to it or not. In this case, the queue has no policy applied to it:

A queue without a policy

How to see which policy is applied to a queue?

If a policy is applied to the queue, it will be shown under the "Matched policy" label in the "Policy" card. Here we can see that the policy "My policy" is applied and that it defines both "Max length" and "Message TTL".

Note that those values are also present in the "information" card with a "Policy" badge attached to it, meaning that those values come from the policy and not from the queue itself.

A queue with a policy

How to see if a value is overridden by a policy?

Sometimes both the queue itself and the policy may define the same value. In this case, RabbitMQ will apply the value defined by the policy. RabbitGUI makes it easy to see which value is overridden directly from the UI, here the "Max length" value is overridden by the policy, showing the queue's value 500 crossed over.

A queue with overridden values by policy

What happens when multiple policies match a queue?

Since policies use regexp to match the name of queues, it is possible that multiple policies match the same queue. In this case, RabbitMQ will apply the policy with the highest priority. RabbitGUI shows you all the policies that match a queue, and highlights the one that is applied for easy debugging.

Multiple policies matching the same queue in rabbitmq

More articles about RabbitMQ

How to introspect dead-letter queues with RabbitMQHow to introspect dead-letter queues with RabbitMQBy design, RabbitMQ has no API to peek at arbitrary messages, search for a specific one, or pick one at random. RabbitGUI is a tool that lets you introspect your dead-letter queues easilyProperly setting up dead-letter queues in RabbitMQProperly setting up dead-letter queues in RabbitMQLearn how to set up dead-letter queues in RabbitMQ, including creating a dead-letter exchange, binding it to a queue, and managing rejected messages via policiesRabbitMQ default login and passwordRabbitMQ default login and passwordA quick guide on how to connect to RabbitMQ with the default credentials and how to use RabbitGUI to manage your RabbitMQ instances.

RabbitGUI, the missing RabbitMQ IDE

Debug, monitor, and manage RabbitMQ with a modern developer interface.

Try nowRabbitGUI screenshot