fix(bridge-http): compatible conf with the error format introduced in 5.3.2
This commit is contained in:
parent
2d209ec576
commit
b6391cf18c
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_bridge_http, [
|
{application, emqx_bridge_http, [
|
||||||
{description, "EMQX HTTP Bridge and Connector Application"},
|
{description, "EMQX HTTP Bridge and Connector Application"},
|
||||||
{vsn, "0.2.0"},
|
{vsn, "0.2.1"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [kernel, stdlib, emqx_connector, emqx_resource, ehttpc]},
|
{applications, [kernel, stdlib, emqx_connector, emqx_resource, ehttpc]},
|
||||||
{env, [{emqx_action_info_modules, [emqx_bridge_http_action_info]}]},
|
{env, [{emqx_action_info_modules, [emqx_bridge_http_action_info]}]},
|
||||||
|
|
|
@ -97,7 +97,10 @@ fields("http_action") ->
|
||||||
required => true,
|
required => true,
|
||||||
desc => ?DESC("config_parameters_opts")
|
desc => ?DESC("config_parameters_opts")
|
||||||
})}
|
})}
|
||||||
] ++ emqx_connector_schema:resource_opts_ref(?MODULE, action_resource_opts);
|
] ++
|
||||||
|
emqx_connector_schema:resource_opts_ref(
|
||||||
|
?MODULE, action_resource_opts, fun legacy_action_resource_opts_converter/2
|
||||||
|
);
|
||||||
fields(action_resource_opts) ->
|
fields(action_resource_opts) ->
|
||||||
UnsupportedOpts = [batch_size, batch_time],
|
UnsupportedOpts = [batch_size, batch_time],
|
||||||
lists:filter(
|
lists:filter(
|
||||||
|
@ -342,6 +345,13 @@ mark_request_field_deperecated(Fields) ->
|
||||||
Fields
|
Fields
|
||||||
).
|
).
|
||||||
|
|
||||||
|
legacy_action_resource_opts_converter(Conf, _Opts) when is_map(Conf) ->
|
||||||
|
%% In e5.3.0, we accidentally added `start_after_created` and `start_timeout` to the action resource opts.
|
||||||
|
%% Since e5.4.0, we have removed them. This function is used to convert the old config to the new one.
|
||||||
|
maps:without([<<"start_after_created">>, <<"start_timeout">>], Conf);
|
||||||
|
legacy_action_resource_opts_converter(Conf, _Opts) ->
|
||||||
|
Conf.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Examples
|
%% Examples
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{application, emqx_connector, [
|
{application, emqx_connector, [
|
||||||
{description, "EMQX Data Integration Connectors"},
|
{description, "EMQX Data Integration Connectors"},
|
||||||
{vsn, "0.1.36"},
|
{vsn, "0.1.37"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{mod, {emqx_connector_app, []}},
|
{mod, {emqx_connector_app, []}},
|
||||||
{applications, [
|
{applications, [
|
||||||
|
|
|
@ -51,7 +51,8 @@
|
||||||
common_resource_opts_subfields_bin/0,
|
common_resource_opts_subfields_bin/0,
|
||||||
resource_opts_fields/0,
|
resource_opts_fields/0,
|
||||||
resource_opts_fields/1,
|
resource_opts_fields/1,
|
||||||
resource_opts_ref/2
|
resource_opts_ref/2,
|
||||||
|
resource_opts_ref/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([examples/1]).
|
-export([examples/1]).
|
||||||
|
@ -528,13 +529,23 @@ status_and_actions_fields() ->
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
].
|
].
|
||||||
|
|
||||||
resource_opts_ref(Module, RefName) ->
|
resource_opts_ref(Module, RefName) ->
|
||||||
|
resource_opts_ref(Module, RefName, undefined).
|
||||||
|
|
||||||
|
resource_opts_ref(Module, RefName, ConverterFun) ->
|
||||||
|
Meta =
|
||||||
|
case ConverterFun of
|
||||||
|
undefined ->
|
||||||
|
emqx_resource_schema:resource_opts_meta();
|
||||||
|
_ ->
|
||||||
|
M = emqx_resource_schema:resource_opts_meta(),
|
||||||
|
M#{converter => ConverterFun}
|
||||||
|
end,
|
||||||
[
|
[
|
||||||
{resource_opts,
|
{resource_opts,
|
||||||
mk(
|
mk(
|
||||||
ref(Module, RefName),
|
ref(Module, RefName),
|
||||||
emqx_resource_schema:resource_opts_meta()
|
Meta
|
||||||
)}
|
)}
|
||||||
].
|
].
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
actions {
|
||||||
|
http {
|
||||||
|
x_WH_D {
|
||||||
|
connector = connector_x_WH_D
|
||||||
|
enable = true
|
||||||
|
parameters {
|
||||||
|
body = "${clientid}"
|
||||||
|
headers {}
|
||||||
|
max_retries = 2
|
||||||
|
method = post
|
||||||
|
path = ""
|
||||||
|
}
|
||||||
|
resource_opts {
|
||||||
|
health_check_interval = 15s
|
||||||
|
inflight_window = 100
|
||||||
|
max_buffer_bytes = 1GB
|
||||||
|
query_mode = async
|
||||||
|
request_ttl = 45s
|
||||||
|
start_after_created = true
|
||||||
|
start_timeout = 5s
|
||||||
|
worker_pool_size = 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
connectors {
|
||||||
|
http {
|
||||||
|
connector_x_WH_D {
|
||||||
|
connect_timeout = 15s
|
||||||
|
enable = true
|
||||||
|
enable_pipelining = 100
|
||||||
|
headers {content-type = "application/json"}
|
||||||
|
pool_size = 8
|
||||||
|
pool_type = hash
|
||||||
|
ssl {
|
||||||
|
ciphers = []
|
||||||
|
depth = 10
|
||||||
|
enable = false
|
||||||
|
hibernate_after = 5s
|
||||||
|
log_level = notice
|
||||||
|
reuse_sessions = true
|
||||||
|
secure_renegotiate = true
|
||||||
|
verify = verify_peer
|
||||||
|
versions = [tlsv1.3, tlsv1.2]
|
||||||
|
}
|
||||||
|
url = "http://127.0.0.1:18083"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rule_engine {
|
||||||
|
rules {
|
||||||
|
x_WH_D {
|
||||||
|
actions = ["webhook:x_WH_D"]
|
||||||
|
description = x
|
||||||
|
enable = true
|
||||||
|
metadata {created_at = 1699341635802}
|
||||||
|
name = ""
|
||||||
|
sql = "SELECT\n *\nFROM\n \"#\",\n \"$events/message_delivered\",\n \"$events/message_acked\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue