TIBCO JMS Message Selectors: How to Filter EMS Messages in TIBCO

By | January 14, 2015

While working with EMS based messaging in TIBCO, you may come across scenarios where you want to select some specific kind of messages only from a queue or a topic and process that instead of getting all the messages from that destination. JMS provides Message Selector feature which comes into play in this type of scenarios.

In this step by step tutorial, you will learn how to use message selector in TIBCO EMS based processes to filter the messages based on some header properties.


What are EMS Message Selectors?

Message Selector is an API provided by JMS Specifications which is used for filtering of messages from a queue or topic. JMS Message Selector allows a message consumer to specify the messages it is interested in.

Filtering of EMS Messages is done based on an expression which is written in SQL92 syntax. Only those messages which fulfill the condition given in the message selector are consumed by the consumer process while remaining messages remain intact in the queue/topic in the Pending state.

Now let’s proceed with the step by step tibco tutorial which uses message selector to filter EMS Messages.

Business Scenario:

For this tutorial, I am taking a simple example scenario in which we want to consume only those messages from EMS Queue which have status property “Pass”.


Step 1: Create JMS Connection to the Server

The first thing that we need to do is to drag JMS Connection resource from JMS Palette in our TIBCO Designer Project. Configure JMS Connection based on the required values for your EMS Server. Once configured, use Test Connection button to make sure that everything is fine in terms of connectivity with EMS Server.

Configurations of JMS Connection in my case are shown in below screenshot:

jms message selector


Step 2: Create JMS Application Properties

In this step we will add a shared resource JMS Application Properties from JMS palette in which we will define a property named ”status”. This property will be later used for message selector.

JMS Application Properties configured are shown below:

jms application properties

Step 3: Create a Process to Send JMS Messages to a Queue

In this step, we will create a process which will send message to a queue using JMS Queue Sender activity.

In the configuration tab of JMS Queue Sender activity, specify the Connection as well as the destination queue in the similar way as shown in below screenshot:

jms message selector sender configuration


In the Advanced tab, choose JMS Application Properties shared resource which was created in the previous step.

In the Input Editor tab, just create a String Element named as “name” in which we will be sending the name of a person. This is shown in below screenshot:

jms queue sender input editor jms selector tutorial



Now go to Input tab and here we need to give some value to status property field as well as name field. Let’s give “Pass” value to status field so that based on our message selector condition, message gets consumed.

jms sender input mapping jms selector tutorial


Now let’s proceed to the next step in which we will create process to consume EMS message.


Step 4: Create Process to Consume JMS Queue Message with Message Selector

Create a new process and add JMS Queue Receiver from JMS palette as process starter activity. In the configuration tab of this activity, choose JMS Connection and destination queue.

In the Advanced tab, go to Message Selector field. This is the field where we will add expression which will act as a filtering condition for the messages.

As you can see in below screenshot, I have used condition to select only those messages from the queue for which status value is “Pass”.

jms message selector screenshot


In the output editor tab, add name element in the same way as you did for JMS Queue Sender process in previous step.

We are not going to add any further logic in the process to keep it simple.


Step 5: Test JMS Message Selector Based Processes in TIBCO Designer

Validate the project to make sure that everything has been designed and configured correctly. Once validated, load both processes (sender and receiver processes) in designer tester and create a job for Sender process.

As you can see below, message has been sent to queue by sender process and has been successfully consumed by receiver process as selector condition (status=”Pass”) was met:

tester jms message selector example



Now if we try to test these processes by giving a different status property value (e.g. Fail), we will see that message doesn’t get consumed by the consumer as Message Selector condition is not fulfilled:

jms message filter condition not met



This completes our step by step tutorial on TIBCO EMS Message Selector. Feel free to contact me for any further queries or help. Thanks


Ajmal Abbasi

Ajmal Hussain Abbasi is a TIBCO Consultant By Profession with more than 6 years experience in TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Spotfire, TIBCO BE, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in Telecom sector by using his skills in Tibco Designer, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi is also experienced in developing solutions using Oracle PL/Sql, Linux and Java. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn

8 thoughts on “TIBCO JMS Message Selectors: How to Filter EMS Messages in TIBCO

  1. Raj

    Hi Ajmal,

    Your post are decent and useful with code and print screens, which almost none of the TIBCO blogs are providing.

    Here in this example you might wrongly posted a wrong print screen in step 4(Instead of JMS Receiver selector, JMS Connection print screen ). Can you correct the same please?

  2. sham

    Hi Ajmal, Nice Post!!
    I need one help. I am trying to select messages for particular JMSXGroupID. So if one instance of process picks one message, later it should pick messages for JMSXGroupID which is specify in the first message. So I am looking for dynamic message selector. Could you tell me how can i do this?


    1. mohit

      I have similar requrement as Sham mentioned above.
      Basically, what i have seen is that when i have multithreaded consumer JMXSGroupId works in ActiveMQ and delivers it in specific threads.
      But it doesnt work in TIBCO. Any way to acheive same goal.


  3. Aadil

    Can we compare the JMSCorrelationID in the Selector of the Get JMS Queue Message Activity with Message ID of the JMS Sender Activity?

    Here is the scenario. I have sent a message using the JMS Queue Sender Activity. And Now i want to receive the message using the Get JMS activity. How do I write the Selector in the Get JMS Message queue.

    Thanks in advance.

  4. chandra

    hai, ajmal am new to this tibco messaging.
    i want some examples regarding how to create a process which send 5 messages over a queue.so can you please help on this.

  5. Praveenkumar

    Hi Ajmal,
    can you please explain detail of difference between Broker stat and destination stat,



Leave a Reply

Your email address will not be published. Required fields are marked *