File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
lib/src/main/java/ua/naiksoftware/stomp Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -318,4 +318,11 @@ public boolean isConnected() {
318318 public void setLegacyWhitespace (boolean legacyWhitespace ) {
319319 this .legacyWhitespace = legacyWhitespace ;
320320 }
321+
322+ /** returns the to topic (subscription id) corresponding to a given destination
323+ * @param dest the destination
324+ * @return the topic (subscription id) or null if no topic corresponds to the destination */
325+ public String getTopicId (String dest ) {
326+ return topics .get (dest );
327+ }
321328}
Original file line number Diff line number Diff line change 1+ package ua .naiksoftware .stomp .pathmatcher ;
2+
3+ import ua .naiksoftware .stomp .dto .StompHeader ;
4+ import ua .naiksoftware .stomp .dto .StompMessage ;
5+
6+ public class SubscriptionPathMatcher implements PathMatcher {
7+
8+ @ Override
9+ public boolean matches (String path , StompMessage msg ) {
10+ // Compare subscription
11+ String pathSubscription = stompClient .getTopicId (path );
12+ if (pathSubscription == null ) return false ;
13+ String subscription = msg .findHeader (StompHeader .SUBSCRIPTION );
14+ return pathSubscription .equals (subscription );
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments