WSO2 ESB as a JMS sender with ActiveMQ

Posted: October 12, 2013 in linux, ubuntu
Tags: , ,

This tutorial will illustrate how to configure WSO2 ESB as a JMS sender/producer. ESB receives SOAP requests and they are converted to JMS and send to a given queue in ActiveMQ. Fallow the steps below.

  • Download ActiveMQ

Download ActiveMQ from http://activemq.apache.org/download.html

  • Start ActiveMQ
cd [activemq_install_directory]
bin/activemq start
  • Copy Jars to WSO2 ESB

If you are using ActiveMQ version 5.8.0 or later, copy following jars  to <ESB_HOME>/repository/components/lib directory.

  • hawtbuf-1.2.jar
  • activemq-broker-5.9.0.jar
  • activemq-client-5.9.0.jar
  • geronimo-j2ee-management_1.1_spec-1.0.1.jar
  • geronimo-jms_1.1_spec-1.1.1.jar hawtbuf-1.2.jar

If you are using ActiveMQ below 5.8.0 copy the following client libraries from <AMQ_HOME>/lib directory to <ESB_HOME>/repository/components/lib directory.

  • activemq-core-5.5.1.jar
  • geronimo-j2ee-management_1.0_spec-1.0.jar
  • geronimo-jms_1.1_spec-1.1.1.jar
  • Enable JMS sender for ESB
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"\>
  • Add a proxy to ESB
<proxy xmlns="http://ws.apache.org/ns/synapse" name="udara-http-jms" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="jms:/QueueName?transport.jms.DestinationType=queue&transport.jms.ContentTypeProperty=Content-Type&java.naming.provider.url=tcp://localhost:61616&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&transport.jms.ConnectionFactoryType=queue&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"/>
</endpoint>
</target>
</proxy>

“QueueName” – name of the queue in activeMQ the message are stored “tcp://localhost:61616” – ActiveMQ is running locally on port 61616
“QueueConnectionFactory” – We are using the Queue type, not topic

OUT_ONLY indicates that the message exchange flow is one way, only going out. So no response from ESB is expected.

uri="jms:/QueueName?transport.jms.DestinationType=queue&amp;transport.jms.ContentTypeProperty=Content-Type&amp;java.naming.provider.url=tcp://localhost:61616&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;transport.jms.ConnectionFactoryType=queue&amp;transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory"
  • Send a SOAP request to the above created proxy
  • Check the ActiveMQ web console

Browse http://localhost:8161/admin/queues.jsp . You will see a queue name “QueueName” is created and one message is enqueued. It the request we sent in the previous step. Send more requests and refresh the ActiveMQ web console. You will see more messages are coming to the JMS queue.

ActiveMQ Queues

Advertisements
Comments
  1. Pradeep says:

    Can you please provide the sample soap request

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s