1

I'm currently sending Mqtt Messages with Quarkus using smallrye reactive messsaging,the problem is when i add retain flag to true,nothing change.

Here is how i do it:

    @Broadcast
    @Channel("myChannel")
    Emitter<MyObject> emitter; 
emitter.send(MqttMessage.of("/mytopic",data,MqttQoS.EXACTLY_ONCE,true)); 

any help or guidance will be appreciated

beLesKlave
  • 13
  • 5
  • 1
    I assume you meant to include a closing quote after the topic? Note that the leading slash can lead to confusion (this effectively introduces a [zero byte topic level](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/#best-practices)). When you say "nothing change" what do you mean (are you looking at the broker logs, reconnecting and not receiving the retained message etc?). – Brits Dec 20 '21 at 23:57
  • 1
    Edit the question to show how you are testing for a retained message. – hardillb Dec 21 '21 at 08:53
  • Thank you for your replies, to be more clear, I mean when I'm resubscribing to the same topic (In the frontEnd),I don't receive the retained messages. also I test through using an MQTT client for windows also some Google Chrome extensions, – beLesKlave Dec 21 '21 at 21:51
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 27 '21 at 18:12

1 Answers1

0

Try using io.smallrye.reactive.messaging.mqtt.SendingMqttMessage to build your message.