Sending a JMS Message and Receiving a Response in a Process

The JMS Request Reply activity sends a request to a JMS queue and waits for the response. After receiving the response, the activity makes the output available.

Prerequisites

TIBCO Enterprise Message Service must be running.

Procedure

  1. In the samples directory, select palette > jms > RequestReply and double-click tibco.bw.sample.palette.jms.RequestReply. For more information, see Accessing Samples.
  2. In the Project Explorer view, expand the tibco.bw.sample.palette.jms.RequestReply project.
  3. Set the default application profile 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 RequestReply.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.RequestReply.application.
  9. Trigger the application by sending a request. You can use the tibco.bw.sample.palette.jms.QueueReceiver sample to send the request. For more information, see Receiving a JMS Message from a Queue and Responding to the Message. 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 run in the same TIBCO Business Studio for BusinessWorks instance, information similar to the following is displayed in the console:

14:41:00.532 [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.25FC52F2890A4F:5. 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:41:00.548 [bwThread:In-Memory STWorkProcessor-3] INFO c.t.b.p.g.L.t.b.s.p.j.R.Log1 - Received the response. Response = This is a test response. JobId [bw0a100], ProcessInstanceId [bw0a100], Activity [Log1], Process [tibco.bw.sample.palette.jms.requestreply.Process], Module [tibco.bw.sample.palette.jms.RequestReply:1.0.0.qualifier], Application [tibco.bw.sample.palette.jms.RequestReply.application:1.0].

The RequestReply.log output file at C:\tmp\RequestReply shows that the message is sent to the queue and the response is received.