Client Reconnected with Subscriptions Even with `cleanStart` Set True

Hi Hive MQTT community,

I looked at the documentations saying that if we want the Hive MQTT client to reconnect with subscriptions, we have to set cleanStart as false.

However, in my code I set it to True and added addDisconnectedListener. Inside the addDisconnectedListener, I configured context.getReconnector().reconnect(true). It still can automatically resubscribes to all topics I subscribed before on reconnection. I am wondering if it’s the reconnector doing the magic.

I just would like to know why it works.

Thanks

Hello DD_L,

Welcome to the Hive MQTT community! It’s great to have you here, and I appreciate you reaching out with your question.

Understanding the intricacies of code behavior can sometimes be challenging, and I’d be happy to assist you. However, without seeing your complete Java code, it’s difficult for me to provide a precise answer. To better assist you, could you please share a link to your entire project, ensuring that others can build and test it? This will allow us to have a comprehensive view and provide more accurate insights.

Feel free to provide any additional context or details that might help us understand your implementation better. Sharing your code will not only enable a more in-depth analysis but also make it easier for the community to provide valuable feedback.

Thank you for your understanding, and I look forward to assisting you further.

Best regards,
Dasha from HiveMQ Team