This commit is contained in:
anlicheng 2023-09-07 11:10:02 +08:00
parent cbdbc86415
commit 0d30cd471e

View File

@ -99,7 +99,7 @@ handle_info({puback, #{packet_id := PacketId}}, State = #state{inflight = Inflig
%%
handle_info({post, ReceiverPid, #post_data{id = Id, location_code = LocationCode, body = Message}}, State = #state{conn_pid = ConnPid, inflight = InFlight, topic = Topic0, qos = Qos}) ->
Topic = re:replace(Topic0, <<"\\${location_code}">>, LocationCode, [global, {return, binary}]),
lager:debug("[mqtt_postman] will publish topic: ~p, message: ~p, qos: ~p", [Topic, Message, Qos]),
lager:debug("[mqtt_postman] will publish topic: ~p, message: ~ts, qos: ~p", [Topic, Message, Qos]),
case emqtt:publish(ConnPid, Topic, #{}, Message, [{qos, Qos}, {retain, true}]) of
ok ->
ReceiverPid ! {ack, Id},