Sending a JMS Message to a Queue and Waiting for a Response

After sending a JMS message, the JMSSignalIn activity gets the response and filters it as required.

Prerequisites

TIBCO Enterprise Message Service must be running.

Procedure

  1. In the samples directory, select palette > jms > SenderAndSignalIn and double-click tibco.bw.sample.palette.jms.SenderAndSignalIn. For more information, see Accessing Samples .
  2. In the Project Explorer view, expand the tibco.bw.sample.palette.jms.SenderAndSignalIn 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, click the Test Connection button to verify the connection.
  5. Fully expand the Processes directory and double-click QueueSenderWait.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.SenderAndSignalIn.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 running both applications in the same TIBCO Business Studio for BusinessWorks instance, the Console view displays the information similar to the following:

14:46:23.347 [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.25FC52F2890A57:6. JobId [bw0a101], ProcessInstanceId [bw0a101], Activity [Log], Process [tibco.bw.sample.palette.jms.queuereceiver.QueueReceiver], Module [tibco.bw.sample.palette.jms.QueueReceiver:1.0.0.qualifier], Application [tibco.bw.sample.palette.jms.QueueReceiver.application:1.0].

14:46:23.365 [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.25FC52F2890A57:6. JobId [bw0a100], ProcessInstanceId [bw0a100], Activity [Log1], Process [tibco.bw.sample.palette.jms.SenderAndSignalIn.QueueSenderWait], Module [tibco.bw.sample.palette.jms.SenderAndSignalIn:1.0.0.qualifier], Application [tibco.bw.sample.palette.jms.SenderAndSignalIn.application:1.0].

The output.log output file at C:\tmp\SenderAndSignalIn shows that the message has been sent to the queue and the response has been received using Signal-In activity.

Understanding the Configuration

The QueueSenderWait process sends a Queue message and listens for a response. This process definition executes as follows:
  1. The JMS Send Message activity sends a Queue message. It also sets a static reply destination in the advanced tab. The responder uses this reply destination to reply the message.
  2. The JMS SignalIn activity uses Conversation mechanism wherein a conversation is initiated by the Correlation Key, which is JMSMessageID sent by the JMS Queue Sender activity. Conversation "Join" uses JMSCorrelationID to filter the correct response with the correct job.