emqttd not getting all messages in same topic when subscriber application is down

142 Views Asked by At

Only receiving last retained message when subscriber application restarted.

OS: Windows EMQ Broker version : 2.3.10 Eclipse paho

When I am publishing 10 messages on same topic, during that time for some reason subscriber application crashed, after sometime sub application restarted, I am getting only last retaining message only and losing all other data which is big problem.

I am putting Retained flag is true , clean session flag as false and Qos as 1 on both pub and sub.

can some one help on this. Am I missing any configuration or Erlang broker behaves like getting only last retaining message.

1

There are 1 best solutions below

1
On BEST ANSWER

First, the MQTT broker will only hold the last message published to a topic with the retained flag for a given topic. Retained messages are not related to the queuing of high QOS messages for offline clients. For more details on retained messages I suggest you look at this post from HiveMQ

As for queuing messages for an offline client you need to meet all of the following points.

  1. The clean session flag must be set to false
  2. The client ID must remain the same across connections
  3. The message must be published with a QOS > 0
  4. The client must subscribe to the topic with a QOS > 0

For more details about persistence and queued messages look at this other HiveMQ post.