HiveMQ how to create a topic without subscribing first

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:

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

In MQTT messages with no subscribers are dropped, keep in mind that MQTT is a broadcasting protocol not a message queuing system like Kafka or RabbitMQ.

However there are Retained Messages which are persistent even when there are no subscribers. Maybe this could help you with your goal, but only on retained message is possible per topic.

Thank you very much. I think that you described my problem well. I got a task which sees MQTT as a MQ system. Required is as well as the light weight transfer (I have no choice but MQTT) as well message queueing approach as eg AMQP offers.

I tested this aspect of retained messages successfully. However same as above, for the requirement it is not enough to deliver only the last message. In my requirement all messages sent to a Topic (to which no subscriber subscribed yet) need to be delivered after first subsrciption.