Wildcard characters

Wildcard characters can be used by subscribing applications to broaden the scope of publications that they register an interest in. By specifying a wildcard character, the subscriber is specifying a general pattern of the topics they are interested in, rather than an explicit topic.

Wildcard characters are used by both WebSphere MQ Publish/Subscribe and WebSphere Event Broker. However, WebSphere Event Broker provides a different set of wildcard characters that allow a more extensive and flexible use of wildcard characters by subscribers.
  • WebSphere MQ Publish/Subscribe wildcard characters are:
    • An asterisk (*); this matches zero or more characters.
    • A question mark (?); this matches exactly one character.
    • The percent sign (%); this can be used as an escape character to use an "*", a "?", or a "%" character within a topic.
  • WebSphere Event Broker wildcard characters are:
    • The multilevel wild card (the character #); this matches any number of levels at the start or end of the topic.
    • The single-level wild card (the character +); this matches a single level within the topic.

    The characters used are:

The full range of function of the WebSphere Event Broker wildcard characters is only available to MQRFH2 clients. Subscriptions that are made by MQRFH clients to WebSphere Event Broker brokers for topics that contain either of the WebSphere Event Broker wildcard characters are rejected with the reason code MQRCCF_TOPIC_ERROR.

Applications that use MQRFH and connect to WebSphere MQ Publish/Subscribe brokers in a heterogeneous network should therefore not publish on, or subscribe to, topics that contain either the multilevel wild card (#) or single-level wild card (+) characters. WebSphere MQ Publish/Subscribe brokers do not police this; if your applications specify any WebSphere Event Broker wildcard characters in topics when they publish or register a subscription in a heterogeneous broker network, these publications and subscriptions are ignored by WebSphere Event Broker brokers within the network. You are therefore strongly advised to review and if necessary change the topics being used within a WebSphere MQ Publish/Subscribe implementation before adding a WebSphere Event Broker broker to the network.

When applications that use MQRFH2 use the WebSphere Event Broker wildcard characters to target multiple publications from within the WebSphere MQ Publish/Subscribe network, wildcard mapping is performed. In most cases, the broker replaces both the multilevel wild card and the single-level wild card characters with an asterisk. This does not provide an exact match for either of the WebSphere Event Broker wildcard characters, but ensures that a superset of the required publications are sent to the WebSphere Event Broker broker. The WebSphere Event Broker broker evaluates the "#" and "+" wildcard characters to match the correct publications.

For example, the topic "employee/+/development" is propagated as "employee/*/development" to a WebSphere MQ Publish/Subscribe neighbor. This might cause redundant publications to be sent to the WebSphere Event Broker broker from its WebSphere MQ Publish/Subscribe neighbor. However, none of these would be sent to the original client when the WebSphere Event Broker evaluates the original subscription.

The exception to this is a subscription to the topic "+" which is never propagated; it cannot be represented as an "*" because this is the topic that is propagated if a subscription to topic "#" is made at the WebSphere Event Broker broker.

Do not specify WebSphere MQ Publish/Subscribe wildcard characters in MQRFH2 client subscriptions. If you do specify one or more, they are assumed by WebSphere Event Broker to be part of the topic, and are therefore prefixed by the escape character (%) before the subscription is sent on to a WebSphere MQ Publish/Subscribe neighbor.

For example, if your MQRFH2 client subscribes with a topic of "USA/Alaska*/Juneau?", this is modified and passed to a WebSphere MQ Publish/Subscribe broker neighbor as "USA/Alaska%*/Juneau%?".

If an application using MQRFH connects to a WebSphere Event Broker broker, WebSphere Event Broker emulates the behavior of the WebSphere MQ Publish/Subscribe wildcard characters * and ? using a mixture of its own wildcard characters and filter expressions. Existing MQRFH applications that subscribe to a WebSphere Event Broker broker therefore receive the same publications as they would receive if they subscribe to a WebSphere MQ Publish/Subscribe broker.