You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we are missing this.mqttClient.disconnect().waitForCompletion(getDisconnectCompletionTimeout()); alongside with that unsubscribe().
The client.close() has to be done in the destroy() implementation, which we also are missing at the moment.
Fixesspring-projects#3697
SO: https://stackoverflow.com/questions/70374046/spring-integration-mqtt-failed-to-start-app-when-the-network-is-disconnected
* Add `mqttClient.disconnect()` to `Mqttv5PahoMessageDrivenChannelAdapter.doStop()` - the `doStart()` does `connect()`
* Add `Mqttv5PahoMessageDrivenChannelAdapter.destroy()` impl to close `mqttClient`
* Fix `Mqttv5PahoMessageHandler.doStart()` to not re-throw an exception on connection.
Emit an `MqttConnectionFailedEvent` and log error instead
* Fix `Mqttv5PahoMessageHandler.destroy()` to call `mqttClient.close(true)` for better resources clean up
* Improve MQTT v5 components Javadocs and add a reconnect note into `mqtt.adoc`
Fixes#3697
SO: https://stackoverflow.com/questions/70374046/spring-integration-mqtt-failed-to-start-app-when-the-network-is-disconnected
* Add `mqttClient.disconnect()` to `Mqttv5PahoMessageDrivenChannelAdapter.doStop()` - the `doStart()` does `connect()`
* Add `Mqttv5PahoMessageDrivenChannelAdapter.destroy()` impl to close `mqttClient`
* Fix `Mqttv5PahoMessageHandler.doStart()` to not re-throw an exception on connection.
Emit an `MqttConnectionFailedEvent` and log error instead
* Fix `Mqttv5PahoMessageHandler.destroy()` to call `mqttClient.close(true)` for better resources clean up
* Improve MQTT v5 components Javadocs and add a reconnect note into `mqtt.adoc`
In what version(s) of Spring Integration are you seeing this issue?
5.5.6
Describe the bug
Calling
Mqttv5PahoMessageDrivenChannelAdapter.doStop()
does not disconnect and close the underlyingIMqttAsyncClient
spring-integration/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/Mqttv5PahoMessageDrivenChannelAdapter.java
Lines 187 to 200 in 30bb846
Expected behavior
I am not sure if the current behavior is intended or a bug. At least, calling
MqttPahoMessageDrivenChannelAdapter.doStop()
does exactly thatspring-integration/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/MqttPahoMessageDrivenChannelAdapter.java
Lines 202 to 216 in 30bb846
If the current behavior is as desired, what do I need to do to disconnect and close the underlying
IMqttAsyncClient
?The text was updated successfully, but these errors were encountered: