Filters

A filter is an expression, which might include wildcard characters, that is applied to the content of a publication message to determine whether it matches a subscription.

Filters are supported only if your application is using an MQ pub/sub broker; they are not supported by MQTT brokers.

When you register a subscription, in addition to specifying a topic and subscription point, you can specify a filter to select publications according to their contents. In the IBM® MQ subscription properties, filters are referred to as selectors. For more information, see the IBM MQ product documentation online. IBM App Connect Enterprise must know how to parse the contents of the message correctly, which can be achieved in a number of ways:
  • The message is a self-defining XML message.
  • The message template is defined in the MQRFH2 header.

    If the message has an MQRFH header, the message set and type are taken from that header. Otherwise, the message is assumed to be as defined in the properties (domain, set, type, and format) of the input node.

The filter itself is entered as an ESQL expression; for example:
     Body.Name LIKE 'Smit%'

This example means that the contents of a field called Name in the body of a publication message are extracted and compared with the string given in the expression. If the string in the message starts with the characters "Smit", the expression evaluates to TRUE and the publication is sent to the subscriber.

If you want to select publications using filters only, without specifying a topic, you can register a subscription with the required filter and a topic of "#" (all topics). You then receive publications on only those topics for which you have access authority.