Shared Subscription Syntax for MQTT
Hello Solace Community,
I have a question regarding the usage of shared subscriptions with an MQTT client.
I found two different prefixes in the documentation and am curious to learn which is used in which case.
I found in the documentation the following hint (see:
) :
Syntax of Shared Subscriptions
A shared subscription has the form:
#share/<ShareName>/<topicFilter>
Where:
ShareName
is the identifier associated with the shared subscription. It may not contain * or >.
topicFilter
is the topic filter.
But inside the MQTT operational behaviour I find this (see on 4.8.2
A Shared Subscription's Topic Filter MUST start with $share/ and MUST contain a ShareName that is at least one character long[MQTT-4.8.2-1]. The ShareName MUST NOT contain the characters "/", "+" or "#", but MUST be followed by a "/" character. This "/" character MUST be followed by a Topic Filter[MQTT-4.8.2-2] as described in section 4.7.
For me it only worked with $share
in the beginning. But I am now unsure if I missunderstood something. Is the first documentation I quoted and linked not relevant for me ? I was under the assumption that I am using Direct Messaging with QoS 0 and MQTT. So the documentation above should also have worked in my opinion.
So is $share
or #share
correct ? Or maybe both ? :-)
Greetings,
Jan-Filip
Comments
-
Hey @jfg1306 - so
#share/<ShareName>/<topicFilter>
notation is when you are using solace SMF. However when you use MQTT protocol and want to take advantage of the shared subscriptions then you will use the$share/<ShareName>/<topicFilter>
So technically, both are correct but depending on which protocol you are using :) Hopefully this helps!
1 -
Hi Jan-Filip
If you are working with the Solace SMF based APIs like JCSMP, Java, Python etc. shared subscription has the form:
#share/<ShareName>/<topicFilter>
For MQTT client,
$share/{ShareName}/{filter}
is the correct form as mentioned in section 4.8.2 and it is as per the MQTT v5 specs.1