Try OpenEdge Now
skip to main content
Managed Adapters Guide
JMS Managed Adapter : Working with the JMS Adapter : Receiving messages: Passing the CorrelationID
 

Receiving messages: Passing the CorrelationID

When you use the JMS Adapter in Send-Only mode, the adapter’s task is simple: just generate the message using the data from process dataslots, and then send this message to the preconfigured JMSQueue. When a response is expected, there is an additional complication: out of the many incoming messages, you have to find the response to that particular message, and deliver it to the right adapter in the proper context (process instance and workstep). This is achieved using the message’s CorrelationID.
The CorrelationID is a unique string, identifying each message as part of a specific "conversation" between your business process and the external EIS. When a message is created and sent, the JMS Adapter generates this unique CorrelationID, which can be stored in a dataslot. Alternatively, you can define your own CorrelationID using static values or dataslots. Multiple dataslots can be used in the '@ds1:@ds2' format. If a response is expected in the same workstep, there is no need for you, as a process developer, to take further action–the adapter records the CorrelationID of the message it just sent and makes sure that the response with the same ID is delivered to it. However, if the response of a message is sent from one workstep, and you expect to receive the response in another workstep, the sending and receiving adapters need your help to coordinate their work.
When the message is sent by an adapter in the Send-Only workstep, the CorrelationID of the newly generated message is available to you as an optional adapter output. Make sure to map this output to a CHARACTER dataslot, so as to retain the CorrelationID.
Later, in the Receive-Only workstep, map this same dataslot to the CorrelationID input of the receiving adapter. This ensures that the adapter identifies the response message it is waiting for.
To thoroughly understand this configuration, take a look at the following tutorials:
*Tutorial 1: Using the JMS Adapter in Send-Only mode.
*Tutorial 2: Using the JMS Adapter in Send/Receive mode.
*Tutorial 3: Using the JMS Adapter in Send-Only and Receive-Only mode.
*Tutorial 4: JMS Adapter - Receiving messages from external applications.
* Delivering messages to a receive-only workstep in a separate process