WebSphere Message Service Clients for C/C++ and .NET, Version 1.2 Operating Systems: Linux, Windows

Message selectors

An XMS application uses messages selectors to select which 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. 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 satisfy the selection criteria, XMS does not deliver the message and, 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 satisfies the selection criteria of more than one message consumer, XMS delivers the message to each of these consumers.

A message selector expression can reference the following properties of a message: It can also reference the following message header fields: 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 those in WebSphere MQ JMS. For information about how to construct a message selector expression therefore, see WebSphere MQ Using Java. Note, in particular, 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.


Concept topic

Terms of Use | Feedback

Last updated: 11 Nov 2005

© Copyright IBM Corporation 2005. All Rights Reserved.