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.

Before you begin

TIBCO Enterprise Message Service must be running.

    Procedure
  1. In the samples directory, select palette > jms > MessageSelector and double-click tibco.bw.sample.palette.jms.MessageSelector. For more information, see Accessing Samples.
  2. In the Project Explorer view, expand the tibco.bw.sample.palette.jms.MessageSelector project.
  3. Verify your TIBCO Enterprise Message Service connection.
    1. Fully expand the Resources directory.
    2. Double-click JMSConnectionResource.jmsConnResource.
    3. In the Basic Configuration dialog, click the Test Connection button to verify the connection.
  4. Fully expand the Processes directory and double-click MessageSelector.bwp.
  5. Click Run > Debug Configurations.
  6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  7. 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.
  8. Click Debug.
    This runs the sample in Debug mode.
  9. Click the Terminate icon to stop the process.
Result

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.