RabbitMQ: default_limits.vhosts.*.pattern equivalent in advanced.config
search cancel

RabbitMQ: default_limits.vhosts.*.pattern equivalent in advanced.config

book

Article ID: 448838

calendar_today

Updated On:

Products

VMware Tanzu Data Intelligence VMware Tanzu RabbitMQ

Issue/Introduction

An error occurs when configuring the rabbitmq broker to limit the number of queues by vhost using advanced.config format in a TAS environment. 

For example,

rabbitmqctl add_vhost 12345678-1234-1234-1234-123456789abc



Adding vhost "12345678-1234-1234-1234-123456789abc" ...
Error:
{:function_clause, [{:rabbit_db_vhost_defaults, :"-list_limits/1-inlined-0-", [[pattern: ~c"^[0-9a-f\\-]{36}$", max_queues: 300]], [file: ~c"rabbit_db_vhost_defaults.erl", line: 68]}, {:lists, :search_1, 2, [file: ~c"lists.erl", line: 2429]}, {:rabbit_db_vhost_defaults, :list_limits, 1, [file: ~c"rabbit_db_vhost_defaults.erl", line: 67]}, {:rabbit_vhost, :do_add, 3, [file: ~c"rabbit_vhost.erl", line: 199]}, {:rabbit_vhost, :add, 3, [file: ~c"rabbit_vhost.erl", line: 162]}, {:erpc, :execute_call, 4, [file: ~c"erpc.erl", line: 1250]}]}


      {vhosts, [
        [
          {pattern, "^[0-9a-f\\-]{36}$"},
          {max_queues, 300}
        ]
      ]}
    ]}
  ]},
 
 
 

Environment

All supported RabbitMQ on TAS versions.

Cause

When you configure this using rabbitmq.conf (for eg,default_limits.vhosts.1.max_queues = 1000) the cuttlefish layer translates this into a format compatible with rabbit_db_vhost_defaults.

 

Because advanced.config completely bypasses Cuttlefish's parsing layer, RabbitMQ does not run any type conversions or schema transformations.

Without Cuttlefish in the loop to handle the conversion:

  • The outer tuple key must be the string/regex itself ("^[0-9a-f\\\\-]{36}$").

  • The inner property keys must be explicit Erlang binaries (<<"max_queues">>) rather than atoms (max_queues).

Resolution

For the error snippet in the example above, you would need to create an entry in the advanced.config file as shown. This would match both the vhost pattern in the Tanzu Platform environment and limit the max queue size(300, in this example). Note that you would have to merge this correctly in your existing advanced config. 

advanced.config

[
  {rabbit, [
    {default_limits, [
      {vhosts, [
        {"^[0-9a-f\\\\-]{36}$", [{<<"max_queues">>, 300}]}
      ]}
    ]}
  ]}
].

 

The recommended best practice is to use rabbitmq.conf to manage configurations and the equivalent configuration for this use case is  documented here.