Receiving a JMS Message from a Queue and Responding to the Message

The JMS Queue Receiver and Reply to JMS Message activities can be configured to receive and respond to JMS messages.

Prerequisites

TIBCO Enterprise Message Service must be running.

Procedure

  1. In the samples directory, select palette > jms > QueueReceiver and double-click tibco.bw.sample.palette.jms.QueueReceiver. For more information, see Accessing Samples.
  2. In the Project Explorer view, expand the tibco.bw.sample.palette.jms.QueueReceiver 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 QueueReceiver.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.QueueReceiver.application.
  9. Trigger the application by sending a request. You can use the tibco.bw.sample.palette.jms.SenderAndSignalIn sample to send the request. For more information, see Sending a JMS Message to a Queue and Waiting for a Response). The applications can run in the same or separate TIBCO Business Studio™ for BusinessWorks™ instance. If you run the applications in the same instance, load the application before clicking Debug.
  10. Click Debug.
    This runs the sample in Debug mode.
  11. Click the Terminate icon to stop the process.

Result

When both applications are running in the same TIBCO Business Studio for BusinessWorks instance, information similar to the following is displayed in the console:

14:32:46.402 [bwThread:In-Memory STWorkProcessor-2] INFO c.t.b.p.g.L.t.b.s.p.j.Q.Log - Received a Queue Message. Request = This is a test request. JMSMessageID = ID:EMS-SERVER.25FC52F2890A46:6. JobId [bw0a101], ProcessInstanceId [bw0a101], Activity [Log], Process [tibco.bw.sample.palette.jms.queuereceiver.Process], Module [tibco.bw.sample.palette.jms.QueueReceiver:1.0.0.qualifier], Application [tibco.bw.sample.palette.jms.QueueReceiver.application:1.0].

14:32:46.419 [bwThread:In-Memory STWorkProcessor-3] INFO c.t.b.p.g.L.t.b.s.p.j.S.Log1 - Received the response. Response = This is a test response. JMSCorrelationID = ID:EMS-SERVER.25FC52F2890A46:6. JobId [bw0a100], ProcessInstanceId [bw0a100], Activity [Log1], Process [tibco.bw.sample.palette.jms.senderandsignalin.Process], Module [tibco.bw.sample.palette.jms.SenderAndSignalIn:1.0.0.qualifier], Application [tibco.bw.sample.palette.jms.SenderAndSignalIn.application:1.0].

The QueueReceiver.log output file in C:\tmp\QueueReceiver directory shows that the message is received and the reply is sent.

Understanding the Configuration

The sample uses the JMS Queue Receiver activity to get messages off the queue. The Reply to JMS Message activity responds to the incoming JMS message and automatically uses the JMSReplyTo header to get the reply destination.