fix: topic rewrite action type add all
This commit is contained in:
parent
6c2c64118e
commit
60e815fb9a
|
@ -33,6 +33,18 @@ rewrite: [
|
|||
# source_topic = "x/#"
|
||||
# re = "^x/y/(.+)$"
|
||||
# dest_topic = "z/y/$1"
|
||||
# },
|
||||
# {
|
||||
# action = subscribe
|
||||
# source_topic = "x1/#"
|
||||
# re = "^x1/y/(.+)$"
|
||||
# dest_topic = "z1/y/$1"
|
||||
# },
|
||||
# {
|
||||
# action = all
|
||||
# source_topic = "x2/#"
|
||||
# re = "^x2/y/(.+)$"
|
||||
# dest_topic = "z2/y/$1"
|
||||
# }
|
||||
]
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ fields("delayed") ->
|
|||
];
|
||||
|
||||
fields("rewrite") ->
|
||||
[ {action, hoconsc:enum([publish, subscribe])}
|
||||
[ {action, hoconsc:enum([publish, subscribe, all])}
|
||||
, {source_topic, sc(binary(), #{})}
|
||||
, {re, sc(binary(), #{})}
|
||||
, {dest_topic, sc(binary(), #{})}
|
||||
|
|
|
@ -95,7 +95,9 @@ compile(Rules) ->
|
|||
publish ->
|
||||
{[{Topic, MP, Dest} | Acc1], Acc2};
|
||||
subscribe ->
|
||||
{Acc1, [{Topic, MP, Dest} | Acc2]}
|
||||
{Acc1, [{Topic, MP, Dest} | Acc2]};
|
||||
all ->
|
||||
{[{Topic, MP, Dest} | Acc1], [{Topic, MP, Dest} | Acc2]}
|
||||
end
|
||||
end, {[], []}, Rules).
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ api_spec() ->
|
|||
{[rewrite_api()], []}.
|
||||
|
||||
properties() ->
|
||||
properties([{action, string, <<"Node">>, [subscribe, publish]},
|
||||
properties([{action, string, <<"Action">>, [subscribe, publish, all]},
|
||||
{source_topic, string, <<"Topic">>},
|
||||
{re, string, <<"Regular expressions">>},
|
||||
{dest_topic, string, <<"Destination topic">>}]).
|
||||
|
|
Loading…
Reference in New Issue