Using a Process Conversation to Correlate JMS Message Jobs

JMS client and server processes correlate with each other by sending and receiving JMS messages through the process conversation mechanism.

Prerequisites

Use TIBCO ActiveMatrix BusinessWorks™ 6.x server. However, if you want to run ActiveMatrix BusinessWorks™ 5.x server, install ActiveMatrix BusinessWorks 5.x.

TIBCO Enterprise Message Service must be running.

Procedure

  1. In the samples directory, select core > conversation > MultiJobsCorrelation and double-click tibco.bw.sample.core.conversation.MultiJobsCorrelation. For more information, see Accessing Samples.
  2. In the Project Explorer, expand the tibco.bw.sample.core.conversation.MultiJobsCorrelation 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. Fully expand tibco.bw.sample.core.conversation.MultiJobsCorrelation.application and double-click Properties. The output file location defined for the application is displayed in the dialog.
  5. Ensure that the TIBCO Enterprise Message Service server is up and running.
  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.core.conversation.MultiJobsCorrelation.application.
  9. Click Debug.
    This runs the sample in Debug mode.
  10. Click the Terminate icon to stop the process.
  11. For the server created in ActiveMatrix BusinessWorks 5.x:
    1. In TIBCO Business Studio™ for BusinessWorks™, select Module Descriptors > Components and remove Receiver.bwp.
    2. Repeat steps 6 through 8 from above.
    3. Unzip, open, and run bw5/tibco.bw.sample.core.conversation.MultiJobsCorrelation.Server in the TIBCO Designer 5.x Tester.

Result

From the Debugger, expand BWNode to see the jobs created. Jobs are completed in the order of server side reply and not in the order of their creation. The following image shows the resulting console screen.

On UNIX, you can also verify the expected result by tailing the client output to the file /tmp/MultiJobsCorrelation/MultiJobsCorrelation.log.

The MultiJobsCorrelation.log at the C:\tmp\MultiJobsCorrelation location shows requests 1 to 10 when sent in order with the corresponding correlation IDs. The server response is received out of order and the runtime engine correlates each reply to the corresponding request correctly. You see the following output.

Understanding the Configuration

A conversation is configured with an Initiator and a Joiner. Click the WaitForServerReply activity (a JMS Signal-In activity).

Click the Conversations tab. In this case, WaitForServerReply is both the Initiator and Joiner for this conversation.



The WaitForServerReply activity's Initiate action is configured with $ReceiveLaunchMsg/JMSHeader/ns:JMSCorrelationID where SendRequestToServer activity Input is also configured with the same JMSCorrelationID. See the following.



The reason for this configuration is on the ActiveMatrix BusinessWorks 5.x JMSServerProcess side. The Reply To Client activity is configured to send back the same JMSCorrelationID, for the Reply to match with the correct Server Request job.