Monday, November 4, 2013

JMS Correlation ID in WSO2 ESB


You can retrieve original message id from the $header Synapse XPath expression and set it as the JMS_COORELATION_ID property in your message flow. That'll set as the correlation id of the underline JMS message.

<property name="JMS_COORELATION_ID" action="set" scope="axis2" expression="$header/wsa:MessageID" xmlns:wsa="http://www.w3.org/2005/08/addressing"/>

You'll need to define the Xpath appropriately to make sure that it address the both SOAP 1.1 and 1.2 messages.

Or else you can work around it in following method aslo.

1) In the request sequence we grab the message id:
 <property name="msgID" expression="get-property('MessageID')" />
2) In the response sequence we set the correlation id using:
 < roperty name="JMS_COORELATION_ID" expression="get-property('msgID')" scope="axis2" />