JMS message selector

A message selector allows a JMS consumer to be more selective about the messages that it receives from a particular topic or queue.

A message selector uses message properties and headers as criteria in conditional expressions. These expressions use Boolean logic to declare which messages are delivered to a client, such as the JMSInput node.

The following table demonstrates the construction of a message selector. It comprises an identifier, such as the JMSPriority header, or an application controlled property myProperty1. The selector string must specify an operator followed by a literal.

Element Valid values
Identifiers
  • Property or header field reference (such as JMSPriority, myProperty1)
  • The following values are not possible: NULL, TRUE, FALSE, NOT, AND, OR, BETWEEN, LIKE, IN, IS
Operators

AND, OR, LIKE, BETWEEN, =, <>, <,>, <=, >=, IS NULL, IS NOT NULL

Literals
  • The two Boolean literals, TRUE and FALSE
  • Exact number literals that have no decimal point; for example, +25, -399, 40
  • Approximate number literals. These literals can use scientific notation or decimal; for example, -21.4E4, 5E2, +34.4928
  • String literals, for example TargetFunctionName='createOrderOnSuccess'

The JMSInput and JMSReceive nodes provide a free format string PropertySelector, to specify selectors that filter or include application properties. These nodes also have properties for specific header properties, where the identifier is implicit and is generated by the node. For the header selectors, the operator and literal part of the string must be specified.

If more than one selector is specified the node generates a composite selector string, where the individual selector strings are concatenated with the AND operator, and each selector string part is wrapped with parentheses.

The following are examples for each of the selector properties:
Selector property Description
PropertySelector OrderValue> 100.00

This string is used directly as shown. In the JMSInput node, this property is configured by the Application property field.

TimeStamp BETWEEN 1057576423231 AND 10575788993265

Messages that are put between these two Java™ times only (where Java time is milliseconds since 01 Jan 1970 ) is delivered to the JMSInput node. In this case, the string generated is prefixed with the identifier JMSTimestamp.

Delivery Mode PERSISTENT

This setting means that only messages marked by the sender as being PERSISTENT should be delivered to the JMSInput node. In this case, the string that is generated is prefixed with the identifier JMSDeliveryMode.

Priority >= 5 AND <= 8

This setting means that only messages marked by the sender as having a priority 5, 6, 7, or 8 are delivered to the JMSInput node. In this case, the string generated is prefixed with the identifier JMSPriority.

Message ID > WMBRK123456

This setting returns messages with a Message ID that is greater than the value specified. In this case, the string generated is prefixed with the identifier JMSMessageID.

Redelivered FALSE

This setting means that messages that have not been redelivered are received by the node. In this case, the string generated is prefixed with the identifier JMSRedelivered.

Correlation ID = WMBRKABCDEFG

This setting returns messages whose Correlation ID is equal to the value WMBRKBABCDEFG. In this case, the string generated is prefixed with the identifier JMSCorrelationID.