This section describes how to integrate WSO2 Message Broker with WSO2 Enterprise Service Bus to facilitate message brokering needs of the ESB and to implement store and forward messaging pattern.
The first step is to set up WSO2 MB and WSO2 ESB.
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 <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 <MB_HOME>/bin/wso2server.bat (on Windows) .
1. Download and install WSO2 ESB binary distribution. Instructions can be found in the 'http://docs.wso2.org/wiki/display/ESB451/Installation+Guide. of the respective ESB documentation version. For example, The unzipped ESB distribution folder is referred to as ESB_HOME.
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 <transport receiver> block for MB 2.x.x and uncomment it.
Also, uncomment <transport sender> block for JMS in the same file as follows:
3. Copy the following jar files from <MB_HOME>/clent-lib folder to <ESB_HOME>/repository/components/lib folder. T hey are client libraries required from Message Broker to ESB.
4. Open <ESB_HOME>/repository/conf/ JNDI.proerties 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.
The connection factory specifies the URL to be used by a client using WSO2 MB in order to connect to it. 5673 in this example is the port listening for messages on TCP when the AMQP transport is used. This port changes depending on the port offsets done in different scenarios. See Configuring a Client to Access Broker When Port Offset is Change for more information.
5. Start WSO2 ESB by running <ESB_HOME>/bin/wso2server.sh (on Linux) or <ESB_HOME>/bin/wso2server.bat (on Windows).
Both ESB and Message Broker are up and running now.
6. We need some background services to be available for testing purposes. For that, run an ANT task to deploy the “SimpleStockQuoteService” in the simple axis2server as follows.
You now have two instances of WSO2 Message Broker and WSO2 ESB configured, up and running. Next, proceed to integrate the Message Broker with ESB, for which there are two implementation options as follows:
This section describes, through a usecase, how to integrate WSO2 Message Broker with WSO2 ESB as JMS endpoints.
Store a message received to a http proxy of the ESB in a JMS queue. Then consume that queue, get the message and send it to the actual endpoint.
1. We need to create the consumer first to make a subscription for the queue to be used in this usecase. Therefore, create a JMS proxy by the name “StockQuotesQueue”. It is the same name defined in the jndi.properties file above. The Synapse configuration for the proxy looks as follows.
In the code, the consumed message from the JMS queue 'StockQuotesQueue' is logged and sent to the endpoint 'SimpleStockQuoteService'.
2. Create the HTTP proxy to send messages to the JMS Queue. Synapse configuration for this HTTP proxy is as follows. Since this is a one-way message, the property “OUT_ONLY” is set to true and “FORCE_SC_ACCEPTED” property is defined to send a 202 response to the client who invokes this proxy.
The message flow paths are completed. When the 'StockQuoteProxy' is invoked, it will send the message to the queue, which will be consumed by the JMS proxy 'StockQuotesQueue' and send to the actual endpoint.
Using the SOAP UI, send the following SOAP message to 'StockQuoteProxy'.
As the output, this message will be logged in the ESB console and SimpleAxis2Server’s log will be as follows:
This section describes how to integrate WSO2 Message Broker with WSO2 ESB as using message stores and processors.
1. Define a message store by copying and pasting the following config to source view. Alternatively you can use the message-store UI.
2. Define an endpoint to send the message. In this example, the backend just set-up in the previous step is used.
3. Define a message forwarding processor as below by copying and pasting code or using the Management Console UI.
4. Invoke the scenario use a proxy service like below.
Whenever a message comes to this proxy service, it will be stored in JMS message store (which is in Message Broker, JMSMS queue). If message processor is disabled and messages are sent, you will
notice in the Message Broker's management console, the message count of JMSMS queue being increased.
Described here is 'In Only' service invocation with Message Forwarding Processor. Follow the article below to implement the others.
Using the SOAP UI, send the following SOAP message to the InOnlyProxy.
The message will be logged in ESB console. SOAP UI will get 202 Accepted message, and in the axis2Server console, the following message will be logged.
To adapt to your specific environment, simply replace the following with a suitable name.