S Andrew
S Andrew

Reputation: 7198

How to disable mqtt duplicate message in Mosquitto

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

enter image description here

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.?

Upvotes: 0

Views: 1922

Answers (1)

hardillb
hardillb

Reputation: 59618

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

Upvotes: 1

Related Questions