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

   <!-- 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:                                                                  
                                                   
                                               
     Problem                                                                    
                                                                                
                        
                                                                                
                                                                                
                        
     Subscriptions using + (single-level wildcard) or # (multi-level wildcard) 
were silently broken. Publish.send() performed an exact-key lookup 
(ConcurrentHashMap.getOrDefault), so a
      publish to sensor/room1/temperature would never match a subscription 
filter like sensor/+/temperature.                                               
                             
                     
     Changes
   
     1. New: TopicMatcher.java — Utility class implementing MQTT topic filter 
matching per the MQTT-3.1 spec:
       - + matches exactly one topic level
       - # matches any number of levels (must appear at the end of the filter)
       - Wildcards at the first level do not match $-prefixed topics
     2. Modified: SubscribeRepository.java — Added getChannelsByTopic(String 
topic) method that iterates over all stored subscription filters and returns 
channels whose filter matches 
     the published topic using TopicMatcher.matches().                          
                                                                                
                        
     3. Modified: Publish.java:116 — Changed send() from get(topic) (exact-key 
lookup) to getChannelsByTopic(topic) (wildcard-aware matching).                 
                         
     4. New: TopicMatcherTest.java — 6 unit tests covering: exact match, + 
single-level, # multi-level, mixed wildcards, $ topic protection, and null 
inputs.
   
   close [#6851](https://github.com/apache/shenyu/issues/6851)


-- 
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