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 @@ -316,4 +316,11 @@ public boolean isConnected() {
316316 public void setLegacyWhitespace (boolean legacyWhitespace ) {
317317 this .legacyWhitespace = legacyWhitespace ;
318318 }
319+
320+ /** returns the to topic (subscription id) corresponding to a given destination
321+ * @param dest the destination
322+ * @return the topic (subscription id) or null if no topic corresponds to the destination */
323+ public String getTopicId (String dest ) {
324+ return topics .get (dest );
325+ }
319326}
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