Merge pull request #12270 from lafirest/fix/syskeeper

fix(sysk): improve the seakeeper schema
This commit is contained in:
lafirest 2024-01-09 14:41:42 +08:00 committed by GitHub
commit add1368f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 13 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_bridge_syskeeper, [
{description, "EMQX Enterprise Data bridge for Syskeeper"},
{vsn, "0.1.0"},
{vsn, "0.1.1"},
{registered, []},
{applications, [
kernel,

View File

@ -61,7 +61,6 @@ values(put) ->
connector => <<"syskeeper_forwarder">>,
parameters => #{
target_topic => <<"${topic}">>,
target_qos => <<"-1">>,
template => <<"${payload}">>
},
resource_opts => #{
@ -117,8 +116,8 @@ fields("parameters") ->
)},
{target_qos,
mk(
range(-1, 2),
#{desc => ?DESC("target_qos"), default => -1}
range(1, 2),
#{desc => ?DESC("target_qos"), required => false}
)},
{template,
mk(

View File

@ -219,9 +219,8 @@ on_add_channel(
#{
parameters := #{
target_topic := TargetTopic,
target_qos := TargetQoS,
template := Template
}
} = Parameters
}
) ->
case maps:is_key(ChannelId, Channels) of
@ -229,7 +228,7 @@ on_add_channel(
{error, already_exists};
_ ->
Channel = #{
target_qos => TargetQoS,
target_qos => maps:get(target_qos, Parameters, undefined),
target_topic => emqx_placeholder:preproc_tmpl(TargetTopic),
template => emqx_placeholder:preproc_tmpl(Template)
},
@ -335,7 +334,7 @@ render_message(#{id := Id, qos := QoS, clientid := From} = Data, #{
id => emqx_guid:from_hexstr(Id),
qos :=
case TargetQoS of
-1 ->
undefined ->
QoS;
_ ->
TargetQoS

View File

@ -1,5 +1,5 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2022 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2022-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% @doc EMQ X Bridge Sysk Frame
%%--------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2022 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2022-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% @doc EMQ X Bridge Sysk Frame version 1
%%--------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2022 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2022-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
%%--------------------------------------------------------------------
-module(emqx_bridge_syskeeper_proxy).

View File

@ -110,7 +110,6 @@ syskeeper_config(Config) ->
" connector = ~ts\n"
" parameters = {\n"
" target_topic = \"${topic}\"\n"
" target_qos = -1\n"
" template = \"${payload}\"\n"
" },\n"
" resource_opts = {\n"

View File

@ -37,7 +37,7 @@ target_topic.label:
"""Target Topic"""
target_qos.desc:
"""The QoS for the forwarded message, -1 is for the original topic"""
"""The QoS for the forwarded message. To preserve the original QoS of the forwarded message, the value can be omitted."""
target_qos.label:
"""Target QoS"""