Topics

A topic identifies what a publication is about. A topic is a character string that describes the subject of the information that is published in a Publish/Subscribe message. As a subscriber, you can specify a topic or range of topics using wildcards to receive the information that you require.

A topic identifies what a publication is about and consists of a character string that can be up to 10,240 character long. Topics are key to the successful delivery of messages in a Publish/Subscribe system. Instead of including a specific destination address in each message, a publisher assigns a topic to each message. The queue manager matches the topic with a list of subscribers who have subscribed to that topic, and delivers the message to each of those subscribers.

A publisher can control which subscribers receive a publication by choosing carefully the topic that is specified in the message.

The topic of a message does not have to be defined before a publisher can use it; a topic is created when it is specified in a publication or subscription for the first time.

For the latest about topic strings, wildcard characters, special characters, and topic trees, refer to the following information:

  • A topic string can include any character from the Unicode character set, including the space character. However, there are characters that have special meanings. The characters; plus sign (+), number sign (#), asterisk (*), and question mark (?) are described in Wildcard schemes in the online IBM® IBM WebSphere® MQ product documentation.
  • Topic strings are case sensitive, and although a null character does not cause an error, do not use null characters in your topic strings. For the latest information about topic strings, see Using topic strings in the online IBM IBM WebSphere MQ product documentation.
  • Each topic that you define is an element, or node, in the topic tree. For the latest information about topic trees, see Topic trees in the online IBM IBM WebSphere MQ product documentation.

Wildcards and special characters in topic strings

IBM WebSphere MQ supports two different wildcard schemas. Wildcard characters are determined differently according to the schema the subscription uses. This topic details the wildcards used in the Version 7.0 implementation of Publish/Subscribe messaging.

Topics that were created prior to IBM WebSphere MQ Version 7.0 use the schema described in Topics.

A topic can contain any character in the Unicode character set. However, the following three characters have a special meaning in the Version 7.0 Publish/Subscribe:
  • The topic level separator "/".
  • The multilevel wildcard "#".
  • The single-level wildcard "+".

The topic level separator is used to introduce structure into the topic, and can therefore be specified within the topic for that purpose.

Wildcards are a powerful feature of the topic system in IBM WebSphere MQ Publish/Subscribe. Wildcards allow subscribers to subscribe to more than one topic at a time. The multilevel wildcard and single level wildcard can be used for subscriptions, but they cannot be used within a topic by the publisher of a message.

However, if a publisher uses the characters "+" or "#" together with other characters in any topic level within a topic, these characters are not treated as wildcards, and they do not have any special meaning.