Преглед изворни кода

Merge pull request #7812 from DDDHuang/mqtt_bridge_sharesub

fix: remove match topic in mqtt bridge
DDDHuang пре 3 година
родитељ
комит
73ac588255
1 измењених фајлова са 3 додато и 20 уклоњено
  1. 3 20
      apps/emqx_connector/src/mqtt/emqx_connector_mqtt_mod.erl

+ 3 - 20
apps/emqx_connector/src/mqtt/emqx_connector_mqtt_mod.erl

@@ -216,31 +216,14 @@ sub_remote_topics(ClientPid, #{remote_topic := FromTopic, remote_qos := QoS}) ->
 process_config(Config) ->
     maps:without([conn_type, address, receive_mountpoint, subscriptions, name], Config).
 
-maybe_publish_to_local_broker(
-    #{topic := Topic} = Msg,
-    #{remote_topic := SubTopic} = Vars,
-    Props
-) ->
+maybe_publish_to_local_broker(Msg, Vars, Props) ->
     case maps:get(local_topic, Vars, undefined) of
         undefined ->
             %% local topic is not set, discard it
             ok;
         _ ->
-            case emqx_topic:match(Topic, SubTopic) of
-                true ->
-                    _ = emqx_broker:publish(
-                        emqx_connector_mqtt_msg:to_broker_msg(Msg, Vars, Props)
-                    ),
-                    ok;
-                false ->
-                    ?SLOG(warning, #{
-                        msg => "discard_message_as_topic_not_matched",
-                        message => Msg,
-                        subscribed => SubTopic,
-                        got_topic => Topic
-                    })
-            end
-    end.
+            _ = emqx_broker:publish(emqx_connector_mqtt_msg:to_broker_msg(Msg, Vars, Props))
+end.
 
 format_msg_received(
     #{