Contents

 

The JMS selector can be defined to check a particular value for a JMS message property and route messages based on the definition specified.

Defining a JMS Selector

To provide a JMS property string, select the route, click the Selectors property tab and provide a property along with the corresponding value. An empty string is treated as null and implies having no message selector set for the message consumer.

Icon

The order of evaluation of a message selector is from left to right within precedence level. However, this order may be changed using parenthesis.

Operators used in Syntax

Below operators may be used to create a logical condition

Logical operators:

  • NOT
  • AND
  • OR

Comparison operators:

  • =
  • >
  • >=
  • <
  • <=
  • <>
  • LIKE
  • NOT LIKE
  • IS NULL
  • IS NOT NULL

Examples

Below are a few examples using operators listed above.

AND/OR

Icon
"AND" syntax for age between 10 and 20
"OR" syntax for age NOT between 10 and 20

OR/NOT

Icon
"OR" syntax for presence in any of the 3 countries—'UK', 'US', 'France'
"NOT" syntax for absence in any of the 3 countries—'UK', 'US', 'France'

LIKE / NOT LIKE

Icon
"LIKE" syntax for EmpID '123' or '12883' but false for '1234'
"NOT LIKE" syntax for EmpID '1234' but false for '123' or '12883'

NULL / NOT NULL

Icon
IS NULL (to check for a null header field value or a missing property value)
IS NOT NULL (to check for the presence of a non-null header field value or property value)

Scenario

Consider a flow with a feeder and a display connected by a route. Define a selector on the route which allows only those messages which have a property 'testProperty' with value chk.

Steps

To create a JMS selector,

  1. Click the route and type-in the text below in the JMS text box under Selectors properties tab and save the event process.

     testProperty='chk'


    Figure 1: Configuring JMS Selector on a route
     

  2. Run the Event Process after checking the resource and the connectivity.
     
  3. Add the testProperty property to the input message sent from the Feeder. To do this, edit the Name and Value columns by clicking the Add button under the Headers & Attachments tab in the feeder. The message sent will be filtered based on this value.


    Figure 2: Setting property value on a message from the Feeder

  4. Display window shows the message received, because the properties match the ones that were given under the JMS Selectors property. 

Icon
  • Try sending messages with different properties other than what is set for JMS under Selectors and notice that only the messages with the matching properties get through and will be displayed in the Display window.
  • To select all the messages whose value of the testProperty is not chk, create a JMS selector with the expression testProperty<>'chk'
Adaptavist ThemeBuilder EngineAtlassian Confluence