Thursday, April 25, 2013

How to send http messages to jms topic using WSO2 ESB Proxy Service


As the previous blog post How to send http messages to jms Queue using WSO2 ESB. WSO2  ESB has the capability to send messages to Queue in JMS broker. Now I am going to show you how to route the incomming message to  Topic in ActiveMQ JMS broker instead of a Queue using WSO2 ESB proxy service. That can be done easily by changing the endpoint configuration only.

Please refer How to send http messages to jms Queue using WSO2 ESB. for ESB server and ActiveMQ broker configurations for ESB to work with JMS Broker 

Bellow HTTP Proxy service is configured to route incomming message to the topic called TestTopic. Deploy the bellow proxy in WSO2 ESB


<proxy name="StockQuoteProxyToJMSTopic" transports="http" startOnLoad="true" trace="disable">  
     <description/>  
     <target>  
       <inSequence>  
         <property name="OUT_ONLY" value="true"/>  
         <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>  
         <send>  
           <endpoint>  
             <address  
                 uri="jms:/TestTopic?transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://127.0.0.1:61616&amp;transport.jms.DestinationType=topic"/>  
           </endpoint>  
         </send>  
       </inSequence>  
     </target>  
   </proxy>  

Since this is a one-way message, the property “OUT_ONLY” is set to true and “FORCE_SC_ACCEPTED” property is defined to send a 202 response to the client who invokes this proxy.

Once you send to a message to StockQuoteProxyToJMSTopic service via http transport, It will route your message to topic called TestTopic.




No comments:

Post a Comment