Closed chris1705 closed 5 years ago
Hi Christian,
You do not have to set a flag for this, but a session is required so cleanSession(false)
is right.
How are you observing that the messages are not resent?
Could you add a listener to your publish calls and log the throwable like so:
client.publishWith().topic("test").send()
.whenComplete((publish, throwable) -> {
if (throwable != null) {
throwable.printStackTrace();
}
});
Maybe your broker clears the session. Could you add a ConnectedListener that prints the ConnAck message:
final Mqtt3AsyncClient client = Mqtt3Client.builder()
...
.addConnectedListener(context -> TypeSwitch.when(context)
.is(Mqtt3ClientConnectedContext.class, context3 -> System.out.println(context3.getConnAck())))
.buildAsync();
@chris1705 do you still have this problem. If so, could you provide more information? If not please comment and close this issue.
I will close this issue now. Feel free to comment and reopen if you still face this issue.
How can we set a clean session flag in Mqtt5AsyncClient
I can not find method with cleanSession
There is one method cleanStart
is it the same?
@nitinsmartsense Only MQTT 3 has cleanSession. MQTT 5 replaced it with cleanStart + sessionExpiryInterval. You can find more information in this blog post: https://www.hivemq.com/blog/mqtt5-essentials-part4-session-and-message-expiry/
Please open a separate issue in the future or ask questions in our community forum.
Hello Silvio,
I've just started using your library after implementation of automatic reconnect handling.
In my use case the connection is recreated successfully but messages, which were send while there was no connection to MQTT broker, are not resend. I've already tried different configurations (cleanSession = false/true) but it doesn't work. Do I have to set up a specific flag to use this feature? Can you provide an example?
My current code to setup client looks like this:
Regards Christian