Expected behavior
A MQTT-SN subscriber that is disconnected should upon reconnection:
Receive the last retained message sent on a topic, regardless if it was sent while the subscriber was or not connected.
The last message because every time a retained message is sent it replaces the previous retained message in the same topic.
Actual behavior
On reconnection the MQTT-SN subscriber does not receives any message. That occurs for both normal (long) and predefined topic types
To Reproduce
Install HiveMQ-Edge
docker pull hivemq/hivemq-edge
docker run --name hivemq-edge -d -p 1883:1883 -p 8080:8080 -p 2442:2442/udp hivemq/hivemq-edge
Start by subscribing to a topic with a MQTT-SN client
Using a fixed clientID.
Setting both cleanSessio and QoS to either 0 or 1 (same result obtained for all permutations of these values).
./mqtt-sn-java-sub.sh -h 127.0.0.1 -p 2442 -i mqttSN-client-R -t mqttsn/sample/normal/pub/# -q 0
In parallel you can check the behavior subscribing to the same topic using a MQTT client
mosquitto_sub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/#
While subscribed to the topics publish one message in each topic, both retained, each with a different QoS
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/0 -m "hello world, im normal with qos=0" -q 0 -r
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/1 -m "hello world, im normal with qos=1" -q 1 -r
Disconnect subscriber MQTT-SN
stop mqtt-sn-java-sub.sh
Reconnect subscriber MQTT-SN
./mqtt-sn-java-sub.sh -h 127.0.0.1 -p 2442 -i mqttSN-client-R -t mqttsn/sample/normal/pub/# -q 0
no messages in retained even though it was sent while the client MQTT-SN was subscribed
Reconnect subscriber MQTT
mosquitto_sub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/#
the retained messages will be present on reconnection
Disconnect subscriber MQTT-SN
stop mqtt-sn-java-sub.sh
Disconnect subscriber MQTT
stop mosquitto_sub
While the subscriber MQTT-SN is disconnected publish one message in each topic
Both messages in retained, each with a different QoS. Different content than the previous publication (it should replace the previous).
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/0 -m "hello world, im normal with qos=0 0" -q 0 -r
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/1 -m "hello world, im normal with qos=1 0" -q 1 -r
Reconnect subscriber MQTT-SN
./mqtt-sn-java-sub.sh -h 127.0.0.1 -p 2442 -i mqttSN-client-R -t mqttsn/sample/normal/pub/# -q 0
no messages in retained
Reconnect subscriber MQTT
mosquitto_sub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/#
the latest retained messages will be present on reconnection
There are no error logs on the containers image.
Details
- Affected HiveMQ Edge version(s): 2024.9
- Used JVM version: Internal of the container
Expected behavior
A MQTT-SN subscriber that is disconnected should upon reconnection:
Receive the last retained message sent on a topic, regardless if it was sent while the subscriber was or not connected.
The last message because every time a retained message is sent it replaces the previous retained message in the same topic.
Actual behavior
On reconnection the MQTT-SN subscriber does not receives any message. That occurs for both normal (long) and predefined topic types
To Reproduce
Install HiveMQ-Edge
docker pull hivemq/hivemq-edge
docker run --name hivemq-edge -d -p 1883:1883 -p 8080:8080 -p 2442:2442/udp hivemq/hivemq-edge
Start by subscribing to a topic with a MQTT-SN client
Using a fixed clientID.
Setting both cleanSessio and QoS to either 0 or 1 (same result obtained for all permutations of these values).
./mqtt-sn-java-sub.sh -h 127.0.0.1 -p 2442 -i mqttSN-client-R -t mqttsn/sample/normal/pub/# -q 0
In parallel you can check the behavior subscribing to the same topic using a MQTT client
mosquitto_sub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/#
While subscribed to the topics publish one message in each topic, both retained, each with a different QoS
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/0 -m "hello world, im normal with qos=0" -q 0 -r
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/1 -m "hello world, im normal with qos=1" -q 1 -r
Disconnect subscriber MQTT-SN
stop mqtt-sn-java-sub.sh
Reconnect subscriber MQTT-SN
./mqtt-sn-java-sub.sh -h 127.0.0.1 -p 2442 -i mqttSN-client-R -t mqttsn/sample/normal/pub/# -q 0
no messages in retained even though it was sent while the client MQTT-SN was subscribed
Reconnect subscriber MQTT
mosquitto_sub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/#
the retained messages will be present on reconnection
Disconnect subscriber MQTT-SN
stop mqtt-sn-java-sub.sh
Disconnect subscriber MQTT
stop mosquitto_sub
While the subscriber MQTT-SN is disconnected publish one message in each topic
Both messages in retained, each with a different QoS. Different content than the previous publication (it should replace the previous).
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/0 -m "hello world, im normal with qos=0 0" -q 0 -r
mosquitto_pub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/1 -m "hello world, im normal with qos=1 0" -q 1 -r
Reconnect subscriber MQTT-SN
./mqtt-sn-java-sub.sh -h 127.0.0.1 -p 2442 -i mqttSN-client-R -t mqttsn/sample/normal/pub/# -q 0
no messages in retained
Reconnect subscriber MQTT
mosquitto_sub -h 127.0.0.1 -p 1883 -i MQTT-client-R -u artemis -P artemis -t mqttsn/sample/normal/pub/#
the latest retained messages will be present on reconnection
There are no error logs on the containers image.
Details