SMF Topics
Solace Message Format (SMF) is Solace PubSub+’s underlying messaging protocol.
SMF topics have the following properties:
- Consist of NULL-terminated UTF-8 strings composed of one or more levels in the format:
a/b/c
. - The
/
character is used as a separator between levels - which are also referred to as elements - of the string. - A maximum of 128 topic levels are supported.
- The maximum length of a string, excluding the
NULL
terminator, is 250 bytes. - Characters in topic strings are case-sensitive. For example, the topic subscription
animals/domestic/cats
is not equal toAnimals/Domestic/Cats
. - All UTF-8 characters are supported. However, the following characters have special meaning:
- For subscribe topics:
/
is a level separator.<NULL>
is an invalid character.*
is a single-level wildcard.>
can be used as a wildcard, and is a multi-level wildcard when used at the last level of a topic subscription.- A leading
!
, as for example in!a/b/c
, in queue topic subscriptions indicates a subscription exception. For more information, refer to System-Level Subscription Exception Configuration. - For publish topics:
/
is a level separator.<NULL>
is an invalid character.-
*
is treated as a literal character. Avoid using this character when creating topics. >
is treated as a literal character. Avoid using this character when creating topics.- A leading
!
is treated as a literal character. Avoid using this character when creating topics.
MQTT Topic Compatibility
To allow compatibility with MQTT topics, which permit empty topic levels (for example, /a/b
, a//b
, or a/b/
), Solace PubSub+ Version 7.1.1 or greater also allow empty topic levels in SMF topics. However, there are some limitations to using empty topic levels with SMF topics:
- Client applications using Solace messaging APIs can publish to topics with empty levels, but they can't use topic subscriptions with empty levels.
- In ACL profiles, SMF topic exceptions may not have empty topic levels (for publishing or subscribing).
The event broker automatically creates a topic subscription beginning with the prefix #P2P/
for each client, which allows messages to be sent directly to that client (for example, in request/reply scenarios). However, the leading "#" in #P2P
is not valid MQTT syntax. Therefore, to make use of these special Solace subscriptions, MQTT clients can use the string _P2P
instead of #P2P
. The event broker considers these two strings to be equivalent.