You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fix is very simple but looks like I don't have permissions to push and submit a PR. Here's the patch:
topics $ git diff 53a79caad9f0c09ebc4ce5953bb1c480f6ece5a0 memtopics.go
diff --git a/broker/lib/topics/memtopics.go b/broker/lib/topics/memtopics.go
index eb81345..012cf3c 100644
--- a/broker/lib/topics/memtopics.go
+++ b/broker/lib/topics/memtopics.go
@@ -244,6 +244,13 @@ func (this *snode) smatch(topic []byte, qos byte, subs *[]interface{}, qoss *[]b
// let's find the subscribers that match the qos and append them to the list.
if len(topic) == 0 {
this.matchQos(qos, subs, qoss)
+
+ // Also need to consider subscribers to the multi-level wildcard since there can be subscribers _both_ to /foo/bar and /foo/bar/#
+ // Note that if a subscriber is subscribed to _both_ topics it is returned twice as it matches both topics.
+ if mwcn, _ := this.snodes[MWC]; mwcn != nil {
+ mwcn.matchQos(qos, subs, qoss)
+ }
+
return nil
}
Updated tests: (a .go file which I changed to .txt so could attach)
The multi-level wildcard # is not matching an empty subtree. In other words:
A subscription to
/zoo/animal/#
should match
/zoo/animal/zebra
/zoo/animal/elephant
/zoo/animal/bengal/tiger
and it should also match
/zoo/animal
fhmq is not currently handling this case correctly, ie, is not matching /zoo/animal
The following test, which you can run in broker/lib/topics illustrates. (The file is a .go, changed to .txt so could attach)
memtopics_test.txt
The text was updated successfully, but these errors were encountered: