diff --git a/apps/emqx_bridge/etc/emqx_bridge.conf b/apps/emqx_bridge/etc/emqx_bridge.conf index c04abf82a..4eddcb320 100644 --- a/apps/emqx_bridge/etc/emqx_bridge.conf +++ b/apps/emqx_bridge/etc/emqx_bridge.conf @@ -25,8 +25,8 @@ bridges.mqtt.my_mqtt_bridge_to_aws { certfile = "{{ platform_etc_dir }}/certs/client-cert.pem" cacertfile = "{{ platform_etc_dir }}/certs/cacert.pem" } - ## we will create one MQTT connection for each element of the `message_in` - message_in: [{ + ## we will create one MQTT connection for each element of the `ingress_channels` + ingress_channels: [{ ## the `id` will be used as part of the clientid id = "pull_msgs_from_aws" subscribe_remote_topic = "aws/#" @@ -36,8 +36,8 @@ bridges.mqtt.my_mqtt_bridge_to_aws { qos = "${qos}" retain = "${retain}" }] - ## we will create one MQTT connection for each element of the `message_out` - message_out: [{ + ## we will create one MQTT connection for each element of the `egress_channels` + egress_channels: [{ ## the `id` will be used as part of the clientid id = "push_msgs_to_aws" subscribe_local_topic = "emqx/#" diff --git a/apps/emqx_bridge/src/emqx_bridge.erl b/apps/emqx_bridge/src/emqx_bridge.erl index badf97515..adc5592cd 100644 --- a/apps/emqx_bridge/src/emqx_bridge.erl +++ b/apps/emqx_bridge/src/emqx_bridge.erl @@ -154,8 +154,8 @@ update_bridge(Type, Name, Conf) -> %% %% - if the connection related configs like `username` is updated, we should restart/start %% or stop bridges according to the change. - %% - if the connection related configs are not update, but channel configs `message_in` or - %% `message_out` are changed, then we should not restart the bridge, we only restart/start + %% - if the connection related configs are not update, but channel configs `ingress_channels` or + %% `egress_channels` are changed, then we should not restart the bridge, we only restart/start %% the channels. %% logger:info("update ~p bridge ~p use config: ~p", [Type, Name, Conf]), diff --git a/apps/emqx_connector/src/emqx_connector_mqtt.erl b/apps/emqx_connector/src/emqx_connector_mqtt.erl index 4f4d3e5c8..95d19d5e8 100644 --- a/apps/emqx_connector/src/emqx_connector_mqtt.erl +++ b/apps/emqx_connector/src/emqx_connector_mqtt.erl @@ -89,8 +89,8 @@ on_start(InstId, Conf) -> NamePrefix = binary_to_list(InstId), BasicConf = basic_config(Conf), InitRes = {ok, #{name_prefix => NamePrefix, baisc_conf => BasicConf, sub_bridges => []}}, - InOutConfigs = check_channel_id_dup(maps:get(message_in, Conf, []) - ++ maps:get(message_out, Conf, [])), + InOutConfigs = check_channel_id_dup(maps:get(ingress_channels, Conf, []) + ++ maps:get(egress_channels, Conf, [])), lists:foldl(fun (_InOutConf, {error, Reason}) -> {error, Reason}; @@ -108,7 +108,7 @@ on_stop(InstId, #{sub_bridges := NameList}) -> end, NameList). %% TODO: let the emqx_resource trigger on_query/4 automatically according to the -%% `message_in` and `message_out` config +%% `ingress_channels` and `egress_channels` config on_query(_InstId, {create_channel, Conf}, _AfterQuery, #{name_prefix := Prefix, baisc_conf := BasicConf}) -> create_channel(Conf, Prefix, BasicConf); @@ -133,21 +133,21 @@ check_channel_id_dup(Confs) -> end, Confs), Confs. -%% this is an `message_in` bridge +%% this is an `ingress_channels` bridge create_channel(#{subscribe_remote_topic := RemoteT, local_topic := LocalT, id := Id} = InConf, NamePrefix, BasicConf) -> Name = bridge_name(NamePrefix, Id), - logger:info("creating 'message_in' channel ~p, remote ~s -> local ~s", + logger:info("creating ingress channel ~p, remote ~s -> local ~s", [Name, RemoteT, LocalT]), create_sub_bridge(BasicConf#{ name => Name, clientid => clientid(Id), subscriptions => InConf, forwards => undefined}); -%% this is an `message_out` bridge +%% this is an `egress_channels` bridge create_channel(#{subscribe_local_topic := LocalT, remote_topic := RemoteT, id := Id} = OutConf, NamePrefix, BasicConf) -> Name = bridge_name(NamePrefix, Id), - logger:info("creating 'message_out' channel ~p, local ~s -> remote ~s", + logger:info("creating egress channel ~p, local ~s -> remote ~s", [Name, LocalT, RemoteT]), create_sub_bridge(BasicConf#{ name => bridge_name(NamePrefix, Id), diff --git a/apps/emqx_connector/src/mqtt/emqx_connector_mqtt_schema.erl b/apps/emqx_connector/src/mqtt/emqx_connector_mqtt_schema.erl index 184a8610c..28995b666 100644 --- a/apps/emqx_connector/src/mqtt/emqx_connector_mqtt_schema.erl +++ b/apps/emqx_connector/src/mqtt/emqx_connector_mqtt_schema.erl @@ -38,17 +38,17 @@ fields("config") -> , {retry_interval, hoconsc:mk(emqx_schema:duration_ms(), #{default => "30s"})} , {max_inflight, hoconsc:mk(integer(), #{default => 32})} , {replayq, hoconsc:mk(hoconsc:ref(?MODULE, "replayq"))} - , {message_in, hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, "message_in")), #{default => []})} - , {message_out, hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, "message_out")), #{default => []})} + , {ingress_channels, hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, "ingress_channels")), #{default => []})} + , {egress_channels, hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, "egress_channels")), #{default => []})} ] ++ emqx_connector_schema_lib:ssl_fields(); -fields("message_in") -> +fields("ingress_channels") -> [ {subscribe_remote_topic, #{type => binary(), nullable => false}} , {local_topic, hoconsc:mk(binary(), #{default => <<"${topic}">>})} , {subscribe_qos, hoconsc:mk(qos(), #{default => 1})} ] ++ common_inout_confs(); -fields("message_out") -> +fields("egress_channels") -> [ {subscribe_local_topic, #{type => binary(), nullable => false}} , {remote_topic, hoconsc:mk(binary(), #{default => <<"${topic}">>})} ] ++ common_inout_confs();