如何在蚊子中禁用MQTT重复消息
我的机器运行Ubuntu 18.04
我已经安装了蚊子。以下是其Mosquitto.conf
& bridge.conf
文件。
`mosquitto.conf`
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
以下是现在从Python代码的桥梁文件,
connection iothub-bridge
log_type all
address ttpvluk.azure-devices.net:8883
remote_username ttpvluk.azure-devices.net/TX-S2-PVL-0E01
remote_password SharedAccessSignature sr=ttpvluk.azure-devices.net&sig=ylwqmY3N5%2FbnOdaNok4p90pTWg%3D&se=253402280999.36&skn=iothubowner
remote_clientid TX-S2-PVL-0E01
bridge_cafile /etc/ssl/certs/ca-certificates.crt
try_private false
cleansession false
start_type automatic
bridge_insecure false
bridge_protocol_version mqttv311
bridge_tls_version tlsv1.2
notifications false
keepalive_interval 36000
autosave_interval 30
topic # out 2 devices/TX-S2-PVL-0E01/messages/events/ devices/TX-S2-PVL-0E01/messages/events/
topic # in 2 devices/TX-S2-PVL-0E01/messages/devicebound/ devices/TX-S2-PVL-0E01/messages/devicebound/
我将几个数据发送给了Mosquitto Broker,我正在使用Azure Iot Device Explorer进行检查。但是我只是继续使用DUP TRUE检查收到第一条消息。以下是屏幕截图
在蚊子日志中,我可以看到它一次又一次地发送数据我的Python代码停止。
1648738705: Bridge local.TX-S2-PVL-0E01 doing local SUBSCRIBE on topic devices/TX-S2-PVL-0E01/messages/events/#
1648738705: Connecting bridge (step 1) iothub-bridge (ttpvluk.azure-devices.net:8883)
1648738705: Connecting bridge (step 2) iothub-bridge (ttpvluk.azure-devices.net:8883)
1648738705: Bridge TX-S2-PVL-0E01 sending CONNECT
1648738706: Received CONNACK on connection local.TX-S2-PVL-0E01.
1648738706: Bridge local.TX-S2-PVL-0E01 sending UNSUBSCRIBE (Mid: 974, Topic: devices/TX-S2-PVL-0E01/messages/events/#)
1648738706: Bridge local.TX-S2-PVL-0E01 sending SUBSCRIBE (Mid: 975, Topic: devices/TX-S2-PVL-0E01/messages/devicebound/#, QoS: 2, Options: 0x00)
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m10, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m11, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m12, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m13, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m14, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m15, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m16, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m19, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m20, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m21, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m22, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m23, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m24, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m27, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m28, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m29, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m30, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m31, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m32, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m35, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Received UNSUBACK from local.TX-S2-PVL-0E01
1648738706: Received SUBACK from local.TX-S2-PVL-0E01
我该如何解决这个问题?
I have machine running Ubuntu 18.04
where I have installed mosquitto. Below is its mosquitto.conf
& bridge.conf
file.
`mosquitto.conf`
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
Below is the bridge file
connection iothub-bridge
log_type all
address ttpvluk.azure-devices.net:8883
remote_username ttpvluk.azure-devices.net/TX-S2-PVL-0E01
remote_password SharedAccessSignature sr=ttpvluk.azure-devices.net&sig=ylwqmY3N5%2FbnOdaNok4p90pTWg%3D&se=253402280999.36&skn=iothubowner
remote_clientid TX-S2-PVL-0E01
bridge_cafile /etc/ssl/certs/ca-certificates.crt
try_private false
cleansession false
start_type automatic
bridge_insecure false
bridge_protocol_version mqttv311
bridge_tls_version tlsv1.2
notifications false
keepalive_interval 36000
autosave_interval 30
topic # out 2 devices/TX-S2-PVL-0E01/messages/events/ devices/TX-S2-PVL-0E01/messages/events/
topic # in 2 devices/TX-S2-PVL-0E01/messages/devicebound/ devices/TX-S2-PVL-0E01/messages/devicebound/
Now from python code I sent few data to mosquitto broker and I am checking it on azure iot device explorer. But I just keep getting the 1st message with dup true check. Below is the screenshot
In the mosquitto logs as well, I can see that it sending data again and again while my python code is stop.
1648738705: Bridge local.TX-S2-PVL-0E01 doing local SUBSCRIBE on topic devices/TX-S2-PVL-0E01/messages/events/#
1648738705: Connecting bridge (step 1) iothub-bridge (ttpvluk.azure-devices.net:8883)
1648738705: Connecting bridge (step 2) iothub-bridge (ttpvluk.azure-devices.net:8883)
1648738705: Bridge TX-S2-PVL-0E01 sending CONNECT
1648738706: Received CONNACK on connection local.TX-S2-PVL-0E01.
1648738706: Bridge local.TX-S2-PVL-0E01 sending UNSUBSCRIBE (Mid: 974, Topic: devices/TX-S2-PVL-0E01/messages/events/#)
1648738706: Bridge local.TX-S2-PVL-0E01 sending SUBSCRIBE (Mid: 975, Topic: devices/TX-S2-PVL-0E01/messages/devicebound/#, QoS: 2, Options: 0x00)
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m10, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m11, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m12, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m13, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m14, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m15, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m16, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m19, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m20, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m21, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m22, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m23, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m24, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q2, r0, m27, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m28, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m29, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m30, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m31, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m32, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Sending PUBLISH to local.TX-S2-PVL-0E01 (d1, q1, r0, m35, 'devices/TX-S2-PVL-0E01/messages/events/', ... (169 bytes))
1648738706: Received UNSUBACK from local.TX-S2-PVL-0E01
1648738706: Received SUBACK from local.TX-S2-PVL-0E01
How can I resolve this issue.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Azure IoT 中心不支持 QOS 2
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support#sending-device-to-cloud-messages
您已将新娘配置为使用 QOS 2 发送消息
Azure IoT Hub does NOT support QOS 2
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support#sending-device-to-cloud-messages
You have configured the bride to send messages with QOS 2