This section describes how to you can configure the ESB's JMS inbound protocol with WSO2 Message Broker (WSO2 MB).
Note | title | Note
---|
When you configure WSO2 ESB’s JMS inbound protocol with WSO2 MB, the recommended version of WSO2 MB to be used is be sure to use WSO2 MB 3.0.0. We do not recommend the use of WSO2 MB 2.2.0 or lowera previous version. |
Follow the steps below to configure the JMS inbound protocol with WSO2 MB 3.0.0
...
.
Table of Contents |
---|
Start WSO2 MB
Follow the steps given below to set up and start the WSO2 MB server.
Download and install WSO2 MB. For instructions on how to download and install WSO2 MB, see Getting Started with WSO2 MB.
The The unzipped WSO2 MB distribution folder will be referred to as to as<MB_HOME>
throughout the throughout the documentation.Info title Note 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 the the
<MB_HOME>/repository/conf/carbon.xml
file by changing the offset value to 1. For example,as shown below.Code Block language html/xml <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>
- Open a command prompt line terminal and navigate to the
<MB_HOME>/bin
directory. - Execute one of the following startup scripts to start the broker profile:
- On Linux/Mac OS: sh wso2server.sh
On Windows: wso2server.bat --run
Set up WSO2 ESB to connect with the broker
When the ESB is started, it should be able to connect to the relevant queue in WSO2 MB. Follow the steps given below to set up the ESB to connect with the broker.
- Copy the following JAR files from the
<MB_HOME>/clent-lib folder to the <ESB_HOME>/repository/components/lib
folder.andes-client-3.0.1.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
org.wso2.securevault-1.0.0-wso2v2.jar
Open the
<ESB_HOME>/repository/conf/jndi.properties
file and create the connection from the ESB to the WSO2 MB runtime as shown below:Code Block # 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
Note the following in the above configuration:
The virtual host is carbon.
- The ESB is connecting to a queue named
JMSMS
. The topic is commented out since it is not required in this scenario. However, in order to avoid getting the
javax.naming.NameNotFoundException:TopicConnectionFactory
exception during server startup, we will maintain theTopicConnectionFactory
as well.
You can now start the WSO2 ESB server and configure the JMS inbound endpoint.
Configure the JMS inbound listener
Configure the JMS inbound listener in the ESB by using the management console:
- Ensure that WSO2 MB is still running.
- Open a command line terminal (or a shell in Linux) and go to the <MBnavigate to the
<ESB_HOME>\/bin
directory. - Start the Message Broker by executing Execute one of the following commands to start the ESB:
- On Linux/Mac OS:
sh wso2server.sh
On Windows:
wso2server.bat
(on Windows). - On Linux/Mac OS:
Setting up WSO2 ESB
- If you have not already done so, see Getting Started with WSO2 ESB for details on installing and running WSO2 ESB.
- Configure the JMS inbound listener. Following
wso2server.bat
- Open the management console of the ESB (from https://10.100.5.12:9443/carbon) and click Inbound Endpoints (in the Main menu) to start creating the endpoint. Listed below are the values you need to provide:
Endpoint Name: jms_inbound
Type: jms
Sequence: request
Error Sequence: fault
Suspend: false
interval: 1000
sequential: true
coordination: true
java.naming.factory.initial: org.wso2.andes.jndi.PropertiesFileInitialContextFactory
java.naming.provider.url: repository/conf/jndi.properties
transport.jms.ConnectionFactoryJNDIName: QueueConnectionFactory
transport.jms.ConnectionFactoryType: queue
transport.jms.Destination: JMSMS
transport.jms.SessionTransacted: false
transport.jms.SessionAcknowledgement: AUTO_ACKNOWLEDGE
transport.jms.CacheLevel: 1
Info For more information on the JMS configuration parameters given above, see JMS Connection Factory Parameters.
Click Save once you have entered all the values as shown below.
Following is a sample JMS inbound listener configuration:
Expand title Sample JMS Inbound Endpoint
suspend="false">Code Block language html/xml <inboundEndpoint xmlns="http://ws.apache.org/ns/synapse" name="jms_inbound" sequence="request" onError="fault" protocol="jms"
<parameters>
<parameter name
interval">1000</parameter>suspend="
transport.jms.CacheLevel">1<false"> <parameters> <parameter name="
interval">1000</parameter>
transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory<<parameter name="
sequential">true</parameter>
sequential<parameter name="
coordination">true</parameter>
<parameter name="java.naming.factory.initial">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">repository/conf/jndi.properties</parameter>
SessionAcknowledgement<parameter name="transport.jms.
>AUTO_ACKNOWLEDGE<ConnectionFactoryJNDIName"
>QueueConnectionFactory</parameter>
SessionTransacted<parameter name="transport.jms.
>false<ConnectionFactoryType"
>queue</parameter>
ConnectionFactoryType<parameter name="transport.jms.
>topic<Destination"
</parameters>>JMSMS</parameter>
</inboundEndpoint><parameter name="transport.jms.SessionTransacted">false</parameter>
Info For more information on the JMS configuration parameters used in the code segments above, see JMS Connection Factory Parameters.
- Copy the following JAR files from the
<MB_HOME>/clent-lib folder to <ESB_HOME>/repository/components/lib
folder.andes-client-3.0.1.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
org.wso2.securevault-1.0.0-wso2v2.jar
Open Use carbon as the virtual host.
- Define a queue named
JMSMS
. - Ensure that WSO2 Message Broker is running, and then open a command prompt (or a shell in Linux) and go to the
<ESB_HOME>\bin
directory. - Start the ESB server by executing
sh wso2server.sh -Dqpid.dest_syntax=BURL
(on Linux/OS X) orwso2server.bat -Dqpid.dest_syntax=BURL
(on Windows).<parameter name="transport.jms.SessionAcknowledgement">AUTO_ACKNOWLEDGE</parameter> <parameter name="transport.jms.CacheLevel">1</parameter> <parameter name="transport.jms.SubscriptionDurable">false</parameter> <parameter name="transport.jms.SharedSubscription">false</parameter> </parameters> </inboundEndpoint>
<ESB_HOME>/repository/conf/jndi.properties
file and make a reference to the running Message Broker as specified below: Comment out the topic, since it is not required in this scenario. However, in order to avoid getting the javax.naming.NameNotFoundException:TopicConnectionFactory
exception during server startup, make a reference to the Message Broker from the TopicConnectionFactory
as well.
Code Block |
---|
# 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 |
Now you have an instance of WSO2 Message Broker MB and a WSO2 an ESB inbound endpoint configured , up and running. . You can verify this by checking the log in the ESB startup terminal.