wy471x opened a new pull request, #6902:
URL: https://github.com/apache/shenyu/pull/6902

   Parse and store will fields (topic, message, QoS, retain) in WillRepository 
on CONNECT. Publish will message to subscribers on ungraceful disconnect via 
channelInactive hook. Clear will on graceful DISCONNECT. Fix DISCONNECT message 
dispatch in MqttFactory that was previously dropped.
   
   <!-- Describe your PR here; e.g. Fixes #issueNo -->
   
   <!--
   Thank you for proposing a pull request. This template will guide you through 
the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [X] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [X] You submit test cases (unit or integration tests) that back your 
changes.
   - [X] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true`.
   
   ## Summary
   
   ### Core changes:                                                            
                                                                                
                          
   
     - WillRepository.java (new) — A ConcurrentHashMap-backed repository that 
stores WillEntry (topic, message bytes, QoS, retain flag) keyed by Netty 
Channel. Implements the existing 
     BaseRepository interface.
     - Connect.java — On CONNECT, if isWillFlag() is true, extracts the will 
fields from the MQTT CONNECT payload and stores them via WillRepository.        
                           
     - Disconnect.java — On graceful DISCONNECT, removes the will from 
WillRepository (so it won't fire). Replaces the old // todo Last words 
placeholder.                              
     - MqttTransportHandler.java — Overrides channelInactive() to detect 
ungraceful disconnects. If a will is still present for that channel when it 
goes inactive, it publishes the    
     will via Publish.publishWill() and then clears it.                         
                                                                                
                        
     - Publish.java — New publishWill() static method that looks up subscribers 
for the will topic and writes the will message as an MQTT PUBLISH packet to 
each active subscriber      
     channel.                                                                   
                                                                                
                        
     - MqttFactory.java — Fixes a bug where DISCONNECT was falling through to 
PUBACK/default instead of calling messageType.disconnect(ctx).
     - pom.xml — Adds JUnit Jupiter, Mockito, and maven-surefire-plugin with 
--add-opens JVM args for testing.                                               
                           
                                                                                
                                                                                
                        
   ### Tests (5 new test files): 
   
   - ConnectTest, DisconnectTest, MqttTransportHandlerTest, PublishWillTest, 
and WillRepositoryTest — covering will storage on connect, will clearance on 
disconnect, will firing on channel inactivity, inactive channel skipping, empty 
subscriber handling, and QoS/retain flag propagation. 
   
   close [#6852](https://github.com/apache/shenyu/issues/6852)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to