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 WSO2 Message Broker
This section describes how to configure the WSO2 ESB's JMS transport with WSO2 Message Broker (MB). It facilitates message brokering needs of the ESB and helps implement the store and forward messaging pattern.
Follow the instructions below to set up WSO2 MB and WSO2 ESB.
Setting up WSO2 Message Broker
1. Download and install WSO2 MB binary distribution. Instructions can be found in the 'Installation Guide' of the respective MB documentation version. For example, http://docs.wso2.org/wiki/display/MB201/Installation+Guide. The unzipped MB distribution folder will be referred to as MB_HOME.
It is not possible to start multiple WSO2 products with their default configurations simultaneously in the same environment. Since all WSO2 products use the same port in their default configuration, there will be port conflicts. Therefore, to avoid port conflicts, apply a port offset in <MB_HOME>/repository/conf/carbon.xml file by changing the offset value to 1. For example,
<Ports> <!-- Ports offset. This entry will set the value of the ports defined below to the define value + Offset. e.g. Offset=2 and HTTPS port=9443 will set the effective HTTPS port to 9445 --> <Offset>1</Offset>
2. WSO2 MB uses a Cassandra server that is bundled with it by default for storage. As the Message Broker's port offset is changed by 1 above, change the Cassandra port accordingly by opening <MB_HOME>/repository/conf/advanced/qpid-virtualhosts.xml file and increasing the port by 1. In this case, it will be 9161 (Default 9160 + 1).
Note
This section uses the embedded Cassandra server for configuration. However, in a production setup, using an external Cassandra server which is capable of handling large volumes of queues is recommended. For information on setting up WSO2 MB with an external server, refer to the Deployment Guide at http://docs.wso2.org/wiki/display/MB201/Deployment+Guide.
<store> <class>org.wso2.andes.server.store.CassandraMessageStore</class> <username>admin</username> <password>admin</password> <cluster>ClusterOne</cluster> <idGenerator>org.wso2.andes.server.cluster.coordination.TimeStampBasedMessageIdGenerator</idGenerator> <connectionString>localhost:9161</connectionString> </store>
When an external Cassandra server is used, point the Message Broker to it by editing the value of the <connectionString> accordingly.
3. The default message batch size for browser subscriptions of Message Broker 2.0.1 is a very low value like 2. Increase it to a larger value by adding the following parameter as an immediate child of the root <broker> element to <MB_HOME>/repository/conf/advanced/qpid-config.xml file.
<messageBatchSizeForBrowserSubscriptions>100000</messageBatchSizeForBrowserSubscriptions>
4. Start the Message Broker by running,
- <MB_HOME>/bin/wso2server.sh (on Linux)
- <MB_HOME>/bin/wso2server.bat (on Windows)
Setting up WSO2 ESB
1. Follow the Getting Started and set up WSO2 ESB.
2. Enable the JMS transport of WSO2 ESB to communicate with the Message Broker by editing $ESB_HOME/repository/conf/axis2/axis2.xml file. Find a commented-out <transport receiver> block for MB 2.x.x and un-comment it.
<!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x --> <transportReceiver name="jms" 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>
Also, un-comment <transport sender> block for JMS in the same file as follows:
<!-- uncomment this and configure to use connection pools for sending messages> <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/-->
Infor
3. Copy the following jar files from <MB_HOME>/clent-lib folder to <ESB_HOME>/repository/components/lib folder. They are client libraries required from Message Broker to ESB.
- andes-client-0.13.wso2v4
- geronimo-jms_1.1_spec-1.1.0.wso2v1
4. Open <ESB_HOME>/repository/conf/ JNDI.properties file and point to the running Message Broker.
- Use carbon as the virtualhost.
- Define a queue called JMSMS.
- Comment out the topic as it is not needed. But, in order to avoid getting javax.naming.NameNotFoundException: TopicConnectionFactory during server startup, point TopicConnectionFactory also to the Message Broker.
For example,
# register some connection factories # connectionfactory.[jndiname] = [ConnectionURL] connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673' connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673' # register some queues in JNDI using the form # queue.[jndiName] = [physicalName] queue.JMSMS=JMSMS queue.StockQuotesQueue = StockQuotesQueue
5. Start WSO2 ESB by running,
- <ESB_HOME>/bin/wso2server.sh (on Linux)
- <ESB_HOME>/bin/wso2server.bat (on Windows)
Note
Message Broker should be up and running before starting the ESB.
You now have instances of WSO2 Message Broker and WSO2 ESB configured, up and running. Next, refer to section JMS Usecases for implementation details of various sample scenarios.