Messages published when device was not connected are not received


#1

Dear support team!

I have a problem with getting messages that were published (with QoS 1) while device was not connected. Here are the prerequisites and the cases:

Prerequisites:

  • device is subscribed for topic “#” with QoS 1
  • device is connected with Clear Session = false
  • device interacts with the broker via REST API
  • messages are published with QoS 1

Use case 1:

  • the script receives subscriptions for devices, result is: [["#",1,true]] (as expected)
  • in the script I have looped the part where the messages are pulled in order to have time to publish the message
  • during this loop execution I have published the messages via Web interface
  • as a result of execution I receive the following JSON: [{“dup”:false,“payload”:“dGVzdCAy”,“retain”:false,“tokenId”:"{myTokenId}",“topic”:“test_topic”,“qos”:1}]
  • messages pulling works as expected

Use case 2:

  • I run the same script, however, I publish message BEFORE I start it.
  • Script gets available subscriptions: [["#",1,true]] (as expected)
  • result of pulling the messages is: [] (NOT as expected).

Expected result - to receive JSON with the message published before execution of the script.

Is my understanding correct that for QoS 1 messages should be available in case they are published while device is not connected? This is what I got from the topic Publish message via RestAPI

Please let me know how it should work.

Thank you.

Kind regards,
Andrey


#2

Just to keep it here, to whom it may be interesting:

  • I still have no confirmation if this is a bug or intended behavior, so I assumed it’s designed this way
  • In my script I have overcome this by implementing messages receiving through stash downloading for the cases when my script was not connected to the broker, e.g. due to reconnection because of token expiration or connectivity issues or at script start up.
  • for normal usage I keep pulling messages in the loop with /pull command.

Kind regards,
Andrey