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. WebSphere® MQ Publish/Subscribe recognizes the asterisk (*) and the question mark (?) as wildcard characters.

Note: This information is for WebSphere MQ V6 queue managers only.

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/Tennis
These topics could then be divided further, to separate different types of information about each sport:
Sport/Soccer/Fixtures Sport/Soccer/Results Sport/Soccer/Reports

WebSphere MQ Publish/Subscribe does not recognize that the forward slash (/) character is being used in a special way but if you use the forward slash (/) character as a separator, you can ensure compatibility with other WebSphere business integration applications.

You 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 you 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 you are interested.

Wildcards in topic strings

WebSphere MQ Publish/Subscribe recognizes the following wildcard characters:
Wildcard character Meaning
Asterisk (*) Zero or more characters
Question mark (?) One character
For example, you could use the following topic strings in subscriptions to retrieve particular sets of information:
*
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.

If you want to include the asterisk (*) or question mark (?) in the topic string of a subscription, you must use the percent sign (%) as an escape character. For example, if you want to subscribe to a topic that is named ABC*D, you must enter the string ABC%*D.

If you want to use a % character in the topic string of a subscription, you 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.