WAS v8.5 > Reference > Developer best practices

Topic names and use of wildcard characters in topic expressions

Wildcard characters can be used in topic expressions to retrieve topics provided by the default messaging provider and service integration technologies.

Each subscribe request includes a topic expression that identifies one or more topics the subscription is to be associated with, and the request uses to match against incoming messages.

Subscription topic expressions for the default messaging provider and service integration technologies are based on a subset of the XPath location path syntax.


Identify individual topics

Every topic in a topic space has a topic name consisting of one or more name parts, separated by / (forward slash) characters:


Use wildcards to identify multiple topics

To select one or more topics in a topic space, we can use a topic path, a location path containing wildcard characters. Topic spaces are evaluated using a subset of the XPath location path syntax with the <topicspace> element as the initial context node, so that non-wildcarded topic paths look exactly like topic names.

The syntax for topic paths can be summarized as follows:

The following table lists some example topic paths showing the XPath syntax and the equivalent WBI Message Broker selectors:

XPath syntax and WBI Message Broker selectors. The first column of the table lists some topic path examples. The second column displays the topics selected in the path. The third column provides the equivalent WBI Message Broker selectors.

Topic path Topics selected WBI Message Broker equivalent
A/B Selects the B child of A A/B
A/* Selects all children of A A/+
A//* Selects all descendents of A A/#/+
A//. Selects A and all descendents of A A/#
//* Selects everything # (or #/+)
A/./B Equivalent to A/B A/B
A/*/B Selects all B grandchildren of A A/+/B
A//B Selects all B descendents of A A/#/B
//A Selects all A elements at any level #/A
* Selects all first level elements +


Related concepts:

Publish/subscribe messaging and topic spaces
Wild cards in topic mapping


Related


Create a topic space for publish/subscribe messaging
Add or modifying topic mappings on the WebSphere MQ link publish/subscribe broker
Secure service integration
Administer durable subscriptions


+

Search Tips   |   Advanced Search