Bootstrap FreeKB - RabbitMQ - Create a policy using the rabbitmqctl command set_policy command
RabbitMQ - Create a policy using the rabbitmqctl command set_policy command

Updated:   |  RabbitMQ articles

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 
policy001
".*"
'{
  "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



Comments


Add a Comment


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