...
1. Download and install WSO2 MB according to the instructions in the Getting Started.
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 <MB_HOME>/repository/conf/carbon.xml
file by changing the offset value to 1. For example,
...
2. Start the Message Broker by running <MB_HOME>/bin/wso2server.sh
(on Linux) or or <MB_HOME>/bin/wso2server.bat
(on Windows). Note that Message Broker must be up and running before starting the App Server.
...
1. Download and install WSO2 AS binary distribution. Instructions can be found in the 'Installation Guide' of of the respective AS documentation version. For example, Installation Guide. The The unzipped AS distribution folder is referred to as AS<AS_
HOMEHOME>
.
2. WSO2 AS doesn't come with a default enabled JMS transport configuration to communicate with the Message Broker. Therefore we need to add a <transport receiver>
block for MB 2.x.x by editing $AS<AS_
HOMEHOME>/repository/conf/axis2/axis2.xml
file as follows.
Code Block | ||
---|---|---|
| ||
<!--Configure 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> |
3. Also, uncomment <transport sender>
block for JMS in the same file as follows:
Code Block | ||
---|---|---|
| ||
<!-- uncomment this and configure to use connection pools for sending messages> <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/--> |
4. Then add the following 'jndi.properties' into $ASthe <AS_
HOMEHOME>/repository/conf/
directory in order to point to the running Message Broker.
...
5. Copy the following jar files from the <MB_HOME>/client-lib
folder to the <AS_HOME>/repository/components/lib
folder. They are client libraries required from Message Broker to AS.
• andes-client-0.13.wso2v8
• geronimo-jms_1.1_spec-1.1.0.wso2v1
Info | ||
---|---|---|
| ||
In addition, for App Server 5.1.0, replace $<ASthe <AS_HOME>/repository/components/plugins/axis2-transport-jms_1.1.0.wso2v7.jar file with the one attached here. The reason for this is some recent JMS transport level changes which affects the integration of AS with MB. However, this issue will be fixed from App Server 5.1.1 onwards and this replacement would not be necessary. |
6. Once the JMS transport is enabled for App Server, it will reflect in all the services deployed in App Server and this can cause an unexpected error while the server starts up. Message Broker handles this for axis2 services by using dynamic queue/topic support, however the REST, JS services deployed in App Server still needs to be explicitly configured. Therefore, edit and add the following parameters into the $<AS <AS_HOME>/repository/deployment/server/servicemetafiles/admin/RESTSample.xml
file. Make sure the exposedAllTransports parameter is set to 'false'.
...
Now save all the files and start the App Server by running <AS_HOME>/bin/wso2server.sh
(on Linux) or or <AS_HOME>/bin/wso2server.bat
(on Windows).
...
Use Case: A sample web service
...
in WSO2 AS subscribes to WSO2 Message Broker
This section describes, through a usecase, how to integrate WSO2 Message Broker using a WSO2 AS web service as the JMS subscriber.
Usecase
Deploy use case demonstrates how a web service deployed in WSO2 AS can work as a JMS subscriber for WSO2 MB. In this use case, you will be deploying a sample web service in App Server which listens on SOAP messages and prints message string into console. A JMS queue with the name of this service will be generated in the Message Broker. Publish a message to this queue and it will be received and printed into the App Server console by the sample web service.
1. strings into the console.
- Log into App Server
...
- .
- Go to Home --> Manager --> Services --> Add --> AAR Service
...
- and upload SimpleEventSinkService.aar archive file, which can be downloaded from here. A JMS queue with the name of this service will be generated in the Message Broker.
Log in to Message Broker and publish a text message into the created SimpleEventSinkService queue using the message sender UI.
Code Block language html/xml <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.samples"> <soapenv:Header/> <soapenv:Body> <ser:receive> <!--Optional:--> <ser:message>Test Message</ser:message> </ser:receive> </soapenv:Body> </soapenv:Envelope>
...
- Go to the App Server terminal and the published message will
...
- display in the console as
...
- 'Got the message ==> Test Message'.