Skip to content

Commit e4313bd

Browse files
Merge pull request #11763 from rabbitmq/configure-stream-replication-port-range
Add stream replication port range in ini-style configuration
2 parents 7ac5e89 + eeb35d2 commit e4313bd

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

deps/rabbit/priv/schema/rabbit.schema

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,6 +2665,31 @@ fun(Conf) ->
26652665
list_to_binary(cuttlefish:conf_get("amqp1_0.default_vhost", Conf))
26662666
end}.
26672667

2668+
{mapping, "stream.replication.port_range.min", "osiris.port_range", [
2669+
{datatype, [integer]},
2670+
{validators, ["non_zero_positive_integer"]}
2671+
]}.
2672+
{mapping, "stream.replication.port_range.max", "osiris.port_range", [
2673+
{datatype, [integer]},
2674+
{validators, ["non_zero_positive_integer"]}
2675+
]}.
2676+
2677+
{translation, "osiris.port_range",
2678+
fun(Conf) ->
2679+
Min = cuttlefish:conf_get("stream.replication.port_range.min", Conf, undefined),
2680+
Max = cuttlefish:conf_get("stream.replication.port_range.max", Conf, undefined),
2681+
2682+
case {Min, Max} of
2683+
{undefined, undefined} ->
2684+
cuttlefish:unset();
2685+
{Mn, undefined} ->
2686+
{Mn, Mn + 500};
2687+
{undefined, Mx} ->
2688+
{Mx - 500, Mx};
2689+
_ ->
2690+
{Min, Max}
2691+
end
2692+
end}.
26682693

26692694
% ===============================
26702695
% Validators

deps/rabbit/test/config_schema_SUITE_data/rabbit.snippets

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,38 @@ credential_validator.regexp = ^abc\\d+",
10571057
{incoming_message_interceptors, [{set_header_routing_node, false},
10581058
{set_header_timestamp, false}]}
10591059
]}],
1060+
[]},
1061+
1062+
%%
1063+
%% Stream replication port range
1064+
%%
1065+
1066+
{stream_replication_port_range,
1067+
"
1068+
stream.replication.port_range.min = 4000
1069+
stream.replication.port_range.max = 4600
1070+
",
1071+
[{osiris, [
1072+
{port_range, {4000, 4600}}
1073+
]}],
1074+
[]},
1075+
1076+
{stream_replication_port_range,
1077+
"
1078+
stream.replication.port_range.min = 4000
1079+
",
1080+
[{osiris, [
1081+
{port_range, {4000, 4500}}
1082+
]}],
1083+
[]},
1084+
1085+
{stream_replication_port_range,
1086+
"
1087+
stream.replication.port_range.max = 4600
1088+
",
1089+
[{osiris, [
1090+
{port_range, {4100, 4600}}
1091+
]}],
10601092
[]}
10611093

10621094
].

0 commit comments

Comments
 (0)