Hello, I am currently testing some MQTT setup.
So far I am with RabbitMQ, MQTT WSS, HiveMQ client library.
My use case is such that a publisher posts messages to a topic before actually a subscriber subscribes to the topic for the first time ever. I wish that messages published before the first subscription/connection would be delivered to the subscriber upon its first connection. But this is not happening.
From link below I get the notion that topic is created with either publish or subscribe.
Quoting: “the client does not need to create the desired topic before they publish or subscribe to it”
Similiar idea is also mentioned here:
"…Unlike more “enterprisey” message buses, in MQTT topics are not preregistered. A sender can create topics on the fly…"
I tried to emulate the “A sender can create topics on the fly” && “the client does not need to create the desired topic before they publish or subscribe to it” using the client here:
- create a connection
2.publish to a testtopic/blabla1 content: “blabla1”-> message not listed in messages
3.subsrcibe to a testtopic/blabla1 → message from point 2 not received - PROBLEM FOR ME
4.publish to a testtopic/blabla1 content: “blabla2”-> message listed in messages
The topic in my use case refers to entities which are created and deleted in multiple ways and ad hoc. So having some procedure to initialize the first subscription is not an option either because it would need to be incorporated to many part of our software.
My question is: can I consume a message published to a topic to which a subscriber has not ever connected yet?
Thank you for your effort