Using JMS Message Selector
The JMS Send Message activity sends five queue messages and sets an application property with the index. The Get JMS Queue Message activity selects the third message using message selector.
TIBCO Enterprise Message Service must be running.
- Procedure
- In the samples directory, select and double-click tibco.bw.sample.palette.jms.MessageSelector. For more information, see Accessing Samples.
- In the Project Explorer view, expand the tibco.bw.sample.palette.jms.MessageSelector project.
- Verify your TIBCO Enterprise Message Service connection.
- Fully expand the Resources directory.
- Double-click JMSConnectionResource.jmsConnResource.
- In the Basic Configuration dialog, click the Test Connection button to verify the connection.
- Fully expand the Processes directory and double-click MessageSelector.bwp.
- Click .
- At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
- Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the checkbox next to tibco.bw.sample.palette.jms.MessageSelector.application.
- Click
Debug.
This runs the sample in Debug mode.
- Click the
Terminate
icon to stop the process.
The Console displays a message similar to the following:
11:54:01.283 INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.p.j.M.Log - Sending 5 Queue Messages
11:54:01.409 INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.p.j.M.Log1 - Finished sending 5 Queue messages. Selecting 3rd Message...
11:54:01.475 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.j.M.Log2 - Selected 3rd message,. Message = This is message number 3
Understanding the Configuration
The process sends five Queue messages and selects one message using the selectors. This process definition runs as follows:
- The JMS Send Message activity sends five messages in a loop. It also sets the index of the loop to an application property called myselector.
- The Get JMS Queue Message activity uses the message selector myselector='3' to pick the third message.