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.

Prerequisites

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. Set the default ApplicationProfile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Verify your TIBCO Enterprise Message Service connection.
    1. Fully expand the Resources directory.
    2. Double-click JMSConnectionResource.jmsConnResource.
    3. In the Basic Configuration dialog box, click the Test Connection button to verify the connection.
  5. Fully expand the Processes directory and double-click MessageSelector.bwp.
  6. Click Run > Debug Configurations.
  7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  8. Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the check box next to tibco.bw.sample.palette.jms.MessageSelector.application.
  9. Click Debug.
    This runs the sample in Debug mode.
  10. 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

The MessageSelector.log output file is generated at C:\tmp\MessageSelector folder containing following information based on the message selector.

Sending 5 Queue Messages.

Finished sending 5 Queue messages. Selecting 3rd Message...

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 executes 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.