Monday, April 17, 2017

How to send out the header "JMS_COORELATION_ID" with the message in WSO2 ESB.

In order to send the  "JMS_COORELATION_ID" with the message from wso2 ESB you are required to configure it as a transport header in the synapse configuration.

Hence, the property you need to configure is as below:

 <property name="JMS_COORELATION_ID" value="12345" scope="transport"/>

Please find the proxy configuration below which we tested the above property:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="SMSForwardProxy"
       transports="jms"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="JMS_COORELATION_ID" value="12345" scope="axis2"/>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <parameter name="transport.jms.ContentType">
      <rules>
         <jmsProperty>contentType</jmsProperty>
         <default>text/xml</default>
      </rules>
   </parameter>
   <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
   <parameter name="transport.jms.DestinationType">queue</parameter>
   <parameter name="transport.jms.Destination">SMSStore</parameter>
   <description/>
</proxy>

With the above configuration we managed to send the "JMS_COORELATION_ID" with the message out from the ESB. Please find the logs below:

[2017-04-13 16:19:29,648] DEBUG - wire << "POST /services/SimpleStockQuoteService HTTP/1.1[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_DESTINATION: SMSStore[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_MESSAGE_ID: ID:45c1d2d1-4c1c-3bb7-b249-9af5f0dcf7bf[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_REPLY_TO: SMSReceiveNotificationStore[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_QPID_DESTTYPE: 1[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_PRIORITY: 4[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_TIMESTAMP: 1492080567188[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "JMS_EXPIRATION: 0[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "JMS_COORELATION_ID: 12345[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "JMS_REDELIVERED: false[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "Content-Type: text/xml; charset=UTF-8[\r][\n]"   

No comments:

Post a Comment