Skip to content

Commit 4c5ebd9

Browse files
Support rabbit.connection_max in Cuttlefish schema
1 parent 0870028 commit 4c5ebd9

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

priv/schema/rabbit.schema

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,29 @@ end}.
523523
%% Set the max permissible number of channels per connection.
524524
%% 0 means "no limit".
525525
%%
526-
%% {channel_max, 128},
526+
%% {channel_max, 0},
527527

528528
{mapping, "channel_max", "rabbit.channel_max", [{datatype, integer}]}.
529529

530+
%% Set the max permissible number of client connections per node.
531+
%% `infinity` means "no limit".
532+
%%
533+
%% {connection_max, infinity},
534+
535+
{mapping, "connection_max", "rabbit.connection_max",
536+
[{datatype, [{atom, infinity}, integer]}]}.
537+
538+
{translation, "rabbit.connection_max",
539+
fun(Conf) ->
540+
case cuttlefish:conf_get("connection_max", Conf, undefined) of
541+
undefined -> cuttlefish:unset();
542+
infinity -> infinity;
543+
Val when is_integer(Val) -> Val;
544+
_ -> cuttlefish:invalid("should be a non-negative integer")
545+
end
546+
end
547+
}.
548+
530549
%% Customising Socket Options.
531550
%%
532551
%% See (http://www.erlang.org/doc/man/inet.html#setopts-2) for

test/config_schema_SUITE_data/rabbit.snippets

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,18 @@ tcp_listen_options.exit_on_close = false",
151151
[{rabbit,
152152
[{vm_memory_calculation_strategy, legacy}]}],
153153
[]},
154+
{connection_max,
155+
"connection_max = 999",
156+
[{rabbit,[{connection_max, 999}]}],
157+
[]},
158+
{connection_max,
159+
"connection_max = infinity",
160+
[{rabbit,[{connection_max, infinity}]}],
161+
[]},
162+
{channel_max,
163+
"channel_max = 16",
164+
[{rabbit,[{channel_max, 16}]}],
165+
[]},
154166
{listeners_tcp_ip,
155167
"listeners.tcp.1 = 192.168.1.99:5672",
156168
[{rabbit,[{tcp_listeners,[{"192.168.1.99",5672}]}]}],

0 commit comments

Comments
 (0)