cleanStart=false on reconnect

How do you specify that you want the client to auto reconnect with cleanStart=false? My initial connection is correct with cleanStart=false, but when I force a disconnect of my client form the control center the default reconnect behavior reconnects the client with cleanStart=true.

What do have to changer here:
image

or maybe I need to implement some custom listener code here:

or maybe here:
image

I was able to figure out the solution. On the connection builder you need to add .noSessionExpiry(). This way the session will stay active on the broker and when the client auto reconnects the session config cleanStart=False is retained.

Hello @jonathan ,

Thank you for the outreach!

That is absolutely correct - adding .noSessionExpiry() will implement the a cleanStart = false for MQTT5 clients.

This is a result of an evolution with MQTT5 of the cleanStart feature now using a sessionExpiry value. Some additional details regarding the MQTT5 sessionExpiry can be found in our MQTT Essentials articles here. Some additional examples of reconnect strategies using the HiveMQ MQTT Java client, which I believe to be the client in use here, can be found within our examples directory on the client GitHub page here.

Best,
Aaron from the HiveMQ Team