Mqtt after disconnect

I have a Raspberry Pi with openhab 2.5.1 at my Caravan. It is connected to my System at home by LTE and openvpn. After I losed my Internet connection an openvpn is reconnect later again, mqtt is not able to reconnect to the broker at my home.

If I restart openhab at my Caravan, all works fine.

The same problem if I restart my Raspberry and VPN needs some time to connect to the System at my home.

What can I do?

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
Caused by: com.hivemq.client.mqtt.exceptions.MqttSessionExpiredException: Session expired as connection was closed.
Caused by: com.hivemq.client.mqtt.exceptions.ConnectionClosedException: Server closed connection without DISCONNECT.
2020-02-20 09:09:29.066 [WARN ] [.transport.mqtt.MqttBrokerConnection] - Failed subscribing to topic stat/wohnwagen/gin_bar_rein
java.util.concurrent.CompletionException: com.hivemq.client.mqtt.exceptions.MqttSessionExpiredException: Session expired as connection was closed.

You might write a rule that monitors the state of your broker Thing, and if it is offline periodically retries to connect (by attempting to set the Thing online)

The binding is supposed to keep retrying the connection once it’s lost. That works for me in almost the exact same configuration you describe (though my remote OH is connected via broadband instead of LTE, but it’s OpenVPN and the connection occasionally goes down).

Do you see any attempts to reconnect in the log? I think it tries once every few minutes but I don’t have access to any logs right not to tell for sure.

If not, you may need to file an issue. It’s supposed to try to reconnect automatically.