There are many questions in the XI forum regarding how to allow mutiple JMS sender adpaters to pick different type of messages from one queue. This wiki helps explain the process of how to use the JMS Message Selector setting for the JMS Adapter. This is particularly helpful for fixed width or delimited messages that have different layouts. This illustration helps to visualize the scenario:
Step by Step Solutions:
- First we have to make sure the application publishing the message to the JMS queue includes a specific Property Name and Value into the header of the message. The following figure shows that we have defined the property name ("action") and value for one type of the message. For other type of messages, we have same property name with different Values.
Note: Make certain your queue server is configured to allow more than one connection to the queue because each Adapter you configure with this method will effectively have its own connection.
2. After modifying the publishing application (Sender system), create or modify JMS adapter(s). Go to the Parameter -> Advanced tab. Check "Set Adapter-Specific Message Attribute" and scroll down the current window.
3. Check Specify Additional JMS Message Properties (Maxmum of 10), and add your own property, in this case, it is "Action"
4. In JMS Message Selector field of "Processing" tab, specify property condition: e.g. Action = 'your action value here'
After above setup, activate your adapter. It will now pick up all messages queue when the Action property contains the specified value (in this example the string ending like "...wep.ManageFieldOrder").
Now you can set alternate adapters to pick up the other types of messages you are expecting in the queue.
Caution: If no conditions are satisfied messages could be stranded in the queue!
Caution: If conditions from two adapters looking at the same queue overlap, no warning is given by XI. You will have random results on which adapter picks up the message.
Note: This example was based on the BEA Weblogic queue. OSS Note 1090516 can be referenced while deploying the driver for BEA Weblogic Queue, but the approach can be used for any supported JMS Adapter queue type.