Topic-based wildcards allow you to subscribe to more than one topic at a time.
Using topic-based wildcards enables you to select publications grouped by topic level. There are two types of wildcard used in destinations: Multilevel & Single level.
Multilevel wildcard: #
- The multilevel wildcard character # is used to match any number of levels within a topic. For example, the destination
USA/Alaska/#could select the following topics:
- The multilevel wildcard can represent zero or more levels. Therefore,
USA/#would match the singular
#represents zero levels. In this example there are no levels to separate, so the topic level separator is meaningless.
- The multilevel wildcard is only effective when specified on its own, or next to the topic level separator character. Therefore,
USA/#are valid topics, where the
#character is treated as a wildcard. However, although
USA#is also a valid topic string, the
#character is not regarded as a wildcard, and does not have any special meaning.
Single level wildcard: +
- The single level wildcard character + matches one, and only one, topic level. For example, the destination
USA/+/Springfieldcould select the following topics:
USA/Illinois/Springfield USA/Tennessee/Springfield USA/Oregon/Springfield
- The single level wildcard matches only a single level, therefore
USA/+does not match
- The single level wildcard can be used at any level in the topic tree, and in conjunction with the multilevel wildcard. The single level wildcard must be specified next to the topic level separator, except when it is specified on its own. Therefore,
USA/+are valid topics where the
+character is treated as a wildcard. However, although
USA+is also a valid topic string, the
+character is not regarded as a wildcard and does not have any special meaning.
Note that both Multilevel and Single level wildcards are to be used in destinations created by subscribing applications. When used in publications, they are treated literally.
When topic-based wildcards are not wild
The wildcard characters
# have no special meaning when they are mixed with other characters (including themselves) in a topic level. This means that topics that contain
# together with other characters in a topic level can be published.
# are treated as wildcards, and are therefore not valid in a topic string that is to be published to, but are valid in a destinations created by subscribers.
# are not treated as wildcards, and therefore the topic string can be both published and subscribed to.