WebSphere Message Service Client for C/C++, Version 2.0.2 Operating Systems: AIX, Linux, Solaris, Windows

Message selectors

An XMS application uses messages selectors to select the messages it wants to receive.

When an application creates a message consumer, it can associate a message selector expression with the consumer. The message selector expression specifies the selection criteria.

When an application is connecting to WebSphere MQ V7.0 and above queue manager, the message selection is done at the queue manager side. XMS without doing any selection delivers the message it received from the queue manager, thus providing better performance.

Except for selecting messages by message identifier or correlation identifier, all message selection in previous releases of WebSphere MQ was done by Message Service Client for C/C++. In WebSphere MQ V7.0 and above, all message selection is done by the queue manager on all platforms except z/OS®. For an application connected to a z/OS queue manager, message selection is done by the queue manager in the publish/subscribe domain, but is still done by Message Service Client for C/C++ in the point-to-point domain.

As a result, message throughput is increased for applications that consume messages using message selection, where the message selection is done by the queue manager. The performance improvement is greater for an application that connects in the client mode because only those messages that satisfy the selection criteria are transported over the network, and Message Service Client for C/C++ sees only those messages that it delivers to the application.

However when an application is connecting to WebSphere MQ V6.0 and below, WebSphere Event Broker, WebSphere Message Broker, or WebSphere Service Integration Bus, XMS determines whether each incoming message satisfies the selection criteria. If a message satisfies the selection criteria, XMS delivers the message to the message consumer. If a message does not meet the selection criteria, XMS does not deliver the message to the message consumer. In the point-to-point domain, the message remains on the queue.

An application can create more than one message consumer, each with its own message selector expression. If an incoming message meets the selection criteria of more than one message consumer, XMS delivers the message to each of these consumers.

A message selector expression can see the following properties of a message:
  • JMS-defined properties
  • IBM-defined properties
  • Application-defined properties
It can also see the following message header fields:
  • JMSCorrelationID
  • JMSDeliveryMode
  • JMSMessageID
  • JMSPriority
  • JMSTimestamp
  • JMSType
A message selector expression, however, cannot reference data in the body of a message.
Here is an example of a message selector expression:
JMSPriority > 3 AND manufacturer = 'Jaguar' AND model in ('xj6','xj12')
XMS delivers a message to a message consumer with this message selector expression only if the message has a priority greater than 3; an application-defined property, manufacturer, with a value of Jaguar; and another application defined-property, model, with a value of xj6 or xj12.

The syntax rules for forming a message selector expression in XMS are the same as the one in WebSphere MQ JMS. For information about how to construct a message selector expression, see WebSphere MQ Using Java. Note that, in a message selector expression, the names of JMS-defined properties must be the JMS names, and the names of IBM-defined properties must be the WebSphere MQ JMS names. You cannot use the XMS names in a message selector expression.


Reference topic

Terms of Use | Rate this page

Last updated: 24 May 2011

(C) Copyright IBM Corporation 2005, 2011. All Rights Reserved.