Topics
A topic identifies what a publication is about. Topic names are characters strings. Subscriptions can include wildcard characters to retrieve the information required by the application. IBM MQ Publish/Subscribe recognizes the asterisk (*) and the question mark (?) as wildcard characters.
Topic names
Topic names are strings of characters. You could have high-level topics named 'Sport', 'Stock', 'Films', and 'TV', and you could divide the 'Sport' topic into separate, more specific topics covering different sports; for example:Sport/Soccer Sport/Golf Sport/TennisThese topics could then be divided further, to separate different types of information about each sport:Sport/Soccer/Fixtures Sport/Soccer/Results Sport/Soccer/ReportsIBM MQ Publish/Subscribe does not recognize that the forward slash (/) character is being used in a special way but if we use the forward slash (/) character as a separator, we can ensure compatibility with other WebSphere business integration applications.
We can use any character in the single-byte character set for which the machine is configured in a character string. Consider, however, whether the topic string might need to be translated to a different character representation, in which case we must use only those characters that are available in the configured character set of all relevant machines.
Topic strings are case sensitive, and a blank character has no special meaning. As a subscriber, you can specify a topic or range of topics using wildcards to receive the information in which we are interested.
Wildcards in topic strings
IBM MQ Publish/Subscribe recognizes the following wildcard characters:For example, you could use the following topic strings in subscriptions to retrieve particular sets of information:
Wildcard character Meaning Asterisk (*) Zero or more characters Question mark (?) One character
- *
- All information on Sport, Stock, Films, and TV.
- Sport/*
- All information on Soccer, Golf, and Tennis.
- Sport/Soccer/*
- All information on Soccer (Fixtures, Results, and Reports).
- Sport/*/Results
- All Results for Soccer, Golf, and Tennis.
To include the asterisk (*) or question mark (?) in the topic string of a subscription, we must use the percent sign (%) as an escape character. For example, if we want to subscribe to a topic that is named ABC*D, we must enter the string ABC%*D.
To use a % character in the topic string of a subscription, we must specify two percent signs (%%). A percent sign (%) in a topic string must always be followed by an asterisk (*), a question mark (?), or another percent sign (%).
Wildcards do not span streams.
Parent topic: Configure publish/subscribe for IBM WebSphere MQ Version 6.0 queue managers
Related concepts
Related reference