I am developing a HiveMQ plugin which makes use of
HttpListener . Plugin accepts topic or list of topics as a JSON and returns a clientId (or list of clientIds) of client(-s) subscribed to passed topics.
I am a bit confused on how does
For example there are two clients with client IDs: ClientA & ClientB
- ClientA subscribed on
- ClientB subscribed on
Whenever I ask my plugin to get me subscribers of
test/# only ClientB is returned. Documentation of
getSubscribers method states following:
Returns all MQTT client subscriber identifiers for a given topic, this HiveMQ instance and all other nodes in a HiveMQ cluster. MQTT Wildcards are allowed.
With following description I would expect request for
test/# to return both ClientA & ClientB which is obviously not the case here.
However whenever I request subscribers of
test/sub/topic both ClientA & ClientB client IDs are returned:
This makes me to think that multi-level wildcard passed to
getSubscribers topic is ignored in terms of logic behind it and rather used as a simple string for matching. So my questions would be:
- Is this an expected behaviour?
- Is there a way to get the list of client IDs of clients subscribed to topic that contains certain string?
Or some sort if multi-level wildcard for selecting clients subscribed to topic matching certain pattern. Like, for example, passing
getSubscriberswould return clients subscribed to
I really don’t want to proceed with search of matching topics by iterating via the list of all clients because with hundreds of thousands of clients this might end up hitting performance badly.
I am using HiveMQ 3.4.7 in the example repo, behaviour is the same for v3.4.6 (unfortunately I am limited to versions <4).
HiveMQ SPI v. 3.4.4.
You can easily reproduce behaviour above by checking out repo: GitHub - frankyfish/hivemq-sub-plugin-demo: Demo repository for HiveMQ plugin which accepts MQTT topics list and returns client IDs of subscribed MQTT Clients.
There is a Dockerfile that setups everything.
Copied from my issue on GitHub: SubscriptionStore's getSubscribers doesn't return all topics in case passed topic contains multi-level wildcard · Issue #7 · hivemq/hivemq-spi · GitHub
Thanks in advance!