Description
Version: spring integration mqtt 6.2.1
Java: 11/17/21
Configuration:
autoReconnect: true
cleanSession: true
Expected behaviour:
after receiving exception "Timed out as no write activity, keepAlive=60.000.000.000 lastOutboundActivity=6.114.183.067.622.000 lastInboundActivity=6.114.206.492.058.900 time=6.114.423.973.125.000 lastPing=6.114.183.067.640.300"
the client should reconnect to the broker
Actual behaviour:
the client never reconnects
How to reproduce:
- Write simple mqtt client
- Start in debug mode
- Set a break point when receiving message
- Publish a message via mqtt explorer or whatever client you want
- Stop in break point for, at least, 4 minutes
- Proceed in the application
We identified the potential issue in the callback class.
public class CommsCallback implements Runnable
The problem looks like is in this method.
`public void start(String threadName, ExecutorService executorService) {
this.threadName = threadName;
synchronized(this.lifecycle) {
if (this.current_state == CommsCallback.State.STOPPED) {
this.messageQueue.clear();
this.completeQueue.clear();
this.target_state = CommsCallback.State.RUNNING;
if (executorService == null) {
(new Thread(this)).start();
} else {
this.callbackFuture = executorService.submit(this);
}
}
}
while(!this.isRunning()) {
try {
Thread.sleep(100L);
} catch (Exception var4) {
}
}
}`
When receiving exception the variable current_state
remains in CommsCallback.State.RUNNING
.
While the variable target_state
is in status CommsCallback.State.STOPPED
But, if I stop and restart the mqtt broker, the behaviour is correct (the client reconnects).
I try to open the issue even if I know that the last update on this project was long time ago.