Description
The CONNECT payload's will fields are dropped on the floor; nothing stores a will (module-wide grep for willMessage|willTopic|cleanSession|hasWill returns zero hits), Disconnect never publishes one, and there is no channelInactive/ungraceful-close hook that would fire a will on a dropped connection.
Location
shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/Connect.java (connect method never reads will fields)
shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/Disconnect.java:39 (// todo Last words)
shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/MqttTransportHandler.java:42-44 (empty operationComplete)
Impact
Clients that publish a Last Will during CONNECT never have it delivered on an ungraceful disconnect, defeating a core reliability feature of MQTT.
Suggested fix
Parse and store will fields in MqttContext/session on CONNECT; on channelInactive for a non-clean session with a will, publish the will message with its configured QoS/retain; clear the will on graceful DISCONNECT.
Description
The CONNECT payload's will fields are dropped on the floor; nothing stores a will (module-wide grep for
willMessage|willTopic|cleanSession|hasWillreturns zero hits),Disconnectnever publishes one, and there is nochannelInactive/ungraceful-close hook that would fire a will on a dropped connection.Location
shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/Connect.java(connect method never reads will fields)shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/Disconnect.java:39(// todo Last words)shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/MqttTransportHandler.java:42-44(emptyoperationComplete)Impact
Clients that publish a Last Will during CONNECT never have it delivered on an ungraceful disconnect, defeating a core reliability feature of MQTT.
Suggested fix
Parse and store will fields in
MqttContext/session on CONNECT; onchannelInactivefor a non-clean session with a will, publish the will message with its configured QoS/retain; clear the will on graceful DISCONNECT.