GH-3959: MqttConFailedEvent for normal disconnect (#3961)
* GH-3959: MqttConFailedEvent for normal disconnect Fixes https://github.com/spring-projects/spring-integration/issues/3959 The `MqttCallback.disconnected(MqttDisconnectResponse)` in Paho v5 client is also called when server initiates a disconnection. In this case that `MqttDisconnectResponse` does not have a `cause` value * Modify `MqttConnectionFailedEvent` to make a `cause` property optional * Fix `Mqttv5PahoMessageDrivenChannelAdapter` & `Mqttv5PahoMessageHandler` to not check for `cause`, but emit an `MqttConnectionFailedEvent` for any `disconnected()` calls Unfortunately current Paho v3 client does not call `connectionLost()` for normal disconnections and we cannot react for this callback with an `MqttConnectionFailedEvent` **Cherry-pick to `5.5.x`** * Fix language in doc Co-authored-by: Gary Russell <grussell@vmware.com> Co-authored-by: Gary Russell <grussell@vmware.com>
This commit is contained in:
committed by
Gary Russell
parent
026feeeedf
commit
280eb29f62
@@ -404,6 +404,7 @@ public class MqttJavaApplication {
|
||||
Certain application events are published by the adapters.
|
||||
|
||||
* `MqttConnectionFailedEvent` - published by both adapters if we fail to connect or a connection is subsequently lost.
|
||||
For the MQTT v5 Paho client, this event is also emitted when the server performs a normal disconnection, in which case the `cause` of the lost connection is `null`.
|
||||
* `MqttMessageSentEvent` - published by the outbound adapter when a message has been sent, if running in asynchronous mode.
|
||||
* `MqttMessageDeliveredEvent` - published by the outbound adapter when the client indicates that a message has been delivered, if running in asynchronous mode.
|
||||
* `MqttSubscribedEvent` - published by the inbound adapter after subscribing to the topics.
|
||||
|
||||
Reference in New Issue
Block a user