RabbitMQ - Create a policy using the rabbitmqctl command set_policy command

The rabbitmqctl set_policy command can be used to create a policy. In this example, a policy named policy001 is created in virtual host vhost001 to set the max length to 100 messages. The wildcard applies the policy to all queues.

rabbitmqctl set_policy
--vhost vhost001 
--priority 0
--apply-to queues 
  "max-length": 10, 
  "overflow": "drop-head", 
  "dead-letter-exchange": "deadletter.exchange",
  "dead-letter-routing-key": "dlrk" 


If the policy is successfully created, something like this should be returned.

Setting policy "policy001" for pattern ".*" to "{"max-length": 100, "overflow": "drop-head", "dead-letter-exchange": "deadletter.exchange", "dead-letter-routing-key": "dlrk" }" with priority "0" for vhost "vhost001" ...


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 40099 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |