看起来我又遇到这个问题了,MQTTX 1.8.2 在一段时间没有使用后,重新连接 broker,又重现了立即收到延迟的消息,debug 日志显示:
2022-08-19T17:00:18.834402+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59376 [MQTT] RECV <<50,64,0,14,36,100,101,108,97,121,101,100,47,53,47,120,47,121,141,62,0,123,10,32,32,34,109,115,103,34,58,32,34,104,101,108,108,111,34,44,10,32,32,34,116,111,34,58,32,34,100,101,108,97,121,101,100,32,116,111,112,105,99,34,10,125>>
2022-08-19T17:00:18.834741+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59376 [MQTT] RECV PUBLISH(Q1, R0, D0Topic=$delayed/5/x/y, PacketId=36158, Payload={, "msg": "hello", "to": "delayed topic", })
2022-08-19T17:00:18.835053+00:00 [info] mqttx_e2d00d84@172.21.0.1:59376 PUBLISH to $delayed/5/x/y: <<"{\n \"msg\": \"hello\",\n \"to\": \"delayed topic\"\n}">>
2022-08-19T17:00:18.835472+00:00 [notice] mqttx_e2d00d84@172.21.0.1:59376 [Broker] Stop publishing: Message(Id=0005E69AD0E9758F398900000CC70002, QoS=1, Topic=$delayed/5/x/y, From=<<"mqttx_e2d00d84">>, Flags=[], Headers=#{peerhost => {172,21,0,1}, properties => #{},proto_ver => 5,protocol => mqtt, username => <<"emqx_user">>})
2022-08-19T17:00:18.837385+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59376 [MQTT] SEND PUBACK(Q0, R0, D0PacketId=36158, ReasonCode=16)
2022-08-19T17:00:19.827693+00:00 [info] PUBLISH to x/y: <<"{\n \"msg\": \"hello\",\n \"to\": \"delayed topic\"\n}">>
2022-08-19T17:00:19.828016+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59376 [MQTT] SEND PUBLISH(Q0, R0, D0Topic=x/y, PacketId=undefined, Payload={, "msg": "hello", "to": "delayed topic", })
在重启 EMQX(4.4.6)后延迟发布正常,此时的日志:
2022-08-19T17:02:23.844454+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59406 [MQTT] RECV <<50,64,0,14,36,100,101,108,97,121,101,100,47,53,47,120,47,121,117,66,0,123,10,32,32,34,109,115,103,34,58,32,34,104,101,108,108,111,34,44,10,32,32,34,116,111,34,58,32,34,100,101,108,97,121,101,100,32,116,111,112,105,99,34,10,125>>
2022-08-19T17:02:23.844728+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59406 [MQTT] RECV PUBLISH(Q1, R0, D0Topic=$delayed/5/x/y, PacketId=30018, Payload={, "msg": "hello", "to": "delayed topic", })
2022-08-19T17:02:23.845606+00:00 [info] mqttx_e2d00d84@172.21.0.1:59406 PUBLISH to $delayed/5/x/y: <<"{\n \"msg\": \"hello\",\n \"to\": \"delayed topic\"\n}">>
2022-08-19T17:02:23.847143+00:00 [notice] mqttx_e2d00d84@172.21.0.1:59406 [Broker] Stop publishing: Message(Id=0005E69B0FDA6BA839880000081E0001, QoS=1, Topic=$delayed/5/x/y, From=<<"mqttx_e2d00d84">>, Flags=[], Headers=#{peerhost => {172,21,0,1}, properties => #{},proto_ver => 5,protocol => mqtt, username => <<"emqx_user">>})
2022-08-19T17:02:23.847790+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59406 [MQTT] SEND PUBACK(Q0, R0, D0PacketId=30018, ReasonCode=16)
2022-08-19T17:02:29.849144+00:00 [info] PUBLISH to x/y: <<"{\n \"msg\": \"hello\",\n \"to\": \"delayed topic\"\n}">>
2022-08-19T17:02:29.849712+00:00 [debug] mqttx_e2d00d84@172.21.0.1:59406 [MQTT] SEND PUBLISH(Q0, R0, D0Topic=x/y, PacketId=undefined, Payload={, "msg": "hello", "to": "delayed topic", })