This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Configure with Multiple Brokers
If your system has more than one existing brokers, it will be required to configure the JMS transport with multiple brokers. In such situations, each transport receiver should have a separate name.
The following example illustrates how to configure the WSO2 ESB to listen to both ActiveMQ and WSO2 MB messages.
- Download ActiveMQ (version 5.8.0 or later) from the Apache ActiveMQ site. Download the WSO2 Message Broker from the WSO2 Message Broker site.
- Copy the following client libraries from
<AMQ_HOME>/lib
directory to<ESB_HOME>/repository/components/lib
directory.activemq-broker-5.8.0.jar
activemq-client-5.8.0.jar
geronimo-jms_1.1_spec-1.1.1.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
hawtbuf-1.9.jar
- Copy the
andes-client-0.13.wso2v10.jar
from<MB_HOME>/client-lib
directory to<ESB_HOME>/repository/components/lib
directory. Configure the
<ESB_HOME>/repository/conf/axis2/axis2.xml
file as follows to enable ActiveMQ as a transport listener.<transportReceiver name="jms1" 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>
Enter the following configuration in the same file to enable the WSO2 Message Broker.
<!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x --> <transportReceiver name="jms2" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</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.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</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.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> </transportReceiver>
Note that the transport receiver name is different in each configuration.
Add a topic and a queue to the jndi.properties file located in
<ESB_HOME>/repository/conf
as follows:<connection-factory name="QueueConnectionFactory"> <xa>false</xa> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="/QueueConnectionFactory"/> </entries> </connection-factory> <connection-factory name="TopicConnectionFactory"> <xa>false</xa> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="/TopicConnectionFactory"/> </entries> </connection-factory>
- Start both ActiveMQ and WSO2 MB.
- Start the WSO2 ESB server and the management console. If they are already running, restart them.
Now a proxy service can be created with reference to transport receiver JMS1 and/or JMS2. For example, the following proxy service is configured with reference to both transport receivers.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="jmsMultipleListnerProxy" transports="jms1,jms2" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <log level="full"/> <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>application/xml</default> </rules> </parameter> <description/> </proxy>