Download WSO2 ESB and ActiveMQ. ActiveMQ is used as the jms broker.
Uncomment following configuration from axis2.xml to enable jms transport in WSO2 ESB. axis2.xml can be found in
Copy below jars
activemq-core-5.7.0.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
to $WSO2_ESB_HOME/repository/components/lib. Those jar file can be found from $ActiveMQ_HOME/lib directory
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver>
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
Start jms broker(./activemq console) and create a queue named TestQueue(go to http://0.0.0.0:8161/admin/).
Then Start WSO2 ESB Server(./wso2server.sh) and create a proxy service and a endpoint from bellow configuration
<proxy name="proxyWithJmsEndpoint" transports="https http" startOnLoad="true" trace="disable">
<target endpoint="jmsEndpoint">
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
</inSequence>
<outSequence>
<drop/>
</outSequence>
</target>
</proxy>
<endpoint name="
jmsEndpoint
"> <address uri="jms:/TestQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://127.0.0.1:61616&transport.jms.DestinationType=queue" format="pox"/> </endpoint>
In endpoint, uri format is pox. so it remove the soap envelop and send actual payload. It is useful for REST Services. If you want to send SOAP messages to queue remove format.
Now We have finished the configuration. 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 a SOAP messages via http transport to above proxy service, It will send the messages to TestQueue.