Wildcard Usage in Topic Subscriptions
Wildcard * :
-
At a certain level: When
*appears within a topic subscription (e.g.,sap/s4/*/purchaseorders), it matches any value only at that level. -
At the end of a topic:
*at the end (e.g.,sap/s4/sales/*) matches topics within that level but not deeper levels (e.g.,sap/s4/sales/orders/processedis not matched). -
Prefix matching: When followed by a prefix (e.g.,
sap/finance/abc*/budget), it matches topics with a prefix and any number of characters in between (e.g.,sap/finance/abc/budgetandsap/finance/abcdef/budget). -
Multiple
*usage:*can appear at different levels in the topic pattern(e.g.,sap/s4/*/purchaseorders/*), matching topics at those specific levels (e.g.,sap/s4/domestic/purchaseorders/PO123andsap/s4/international/purchaseorders/PO456). -
Literal
*: If*is used in any other location within a level (e.g.,sap/*financeandsap/fi*ce), it is treated as a literal*and not as a wildcard.
Wildcard > :
-
At the last level: When
>appears at the last level (e.g.,sap/s4/sales/>), it matches one or more levels following the prefix (e.g.,sap/s4/sales/ordersandsap/s4/sales/invoices/US). -
Not at the last level: When
>appears any other place (e.g.,sap/s4>orsap/>/sales), it is treated as a literal character.
Combined use of * and >:
The * and > wildcards can be used together (e.g., sap/*/purchaseorders/>), allowing for flexible topic matching.
Exceptions:
-
Topic pattern will never match special topics starting with
#P2P -
Standalone wildcard
*on a first level (e.g.,*/sap) will not match special topics starting with$
More about Solace PubSub+ Topic Patterns can be found at https://docs.solace.com/Messaging/Wildcard-Charaters-Topic-Subs.htm