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/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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 in the Message Broker documentation. 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. However, in a production setup, using an external Cassandra server that is capable of handling large volumes of queues is recommended. When an external Cassandra server is used, point the Message Broker to it by editing the value of the <connectionString> accordingly. For information on setting up WSO2 MB with an external server, see the Deployment Guide in the Message Broker Documentation.

<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>

3. The default message batch size for browser subscriptions of Message Broker is 200. If needed, you can increase it to a larger value by setting the following property in the <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. If you have not already done so, see Getting Started for details on installing and running WSO2 ESB.

2. Enable the JMS transport of WSO2 ESB to communicate with the Message Broker by editing the <ESB_HOME>/repository/conf/axis2/axis2.xml file. Find a commented-out <transport receiver> block for MB 2.x.x and uncomment 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>

Uncomment the <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"/-->


For details on the JMS configuration parameters used in the code segments above, see JMS Connection Factory Parameters.

 

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.
  • Comment out the topic, as it is not needed. But, in order to avoid the error javax.naming.NameNotFoundException: TopicConnectionFactory during server startup, also point TopicConnectionFactory 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'

5. Ensure that WSO2 Message Broker is running, and then start WSO2 ESB by running one of the following commands:

  • <ESB_HOME>/bin/wso2server.sh (on Linux)
  • <ESB_HOME>/bin/wso2server.bat (on Windows)

You now have instances of WSO2 Message Broker and WSO2 ESB configured and running. Next, refer to section JMS Usecases for implementation details of various sample scenarios.

  • No labels