Creating an integration flow in WSO2 ESB is really a simple concept. Let’s dive into implementing a simple JMS based use case on WSO2 ESB.
The key difference that any integration developer could find with WSO2 ESB is proxy service model. The endpoints are directly exposed in other integration platforms like Apache Camel, Mule ESB, etc.. In WSO2 ESB everything starts with a proxy, the entry to any synapse flow will be a proxy. Other way we can say that the mediations are wrapped by a proxy layer.
Creating a simple flow based on JMS:
The diagram below shows the simple use case which we are going to deploy in WSO2 ESB.
Figure 1: Use case
Note : If the proxy entry is a JMS queue then the input queue name and the proxy service name should be same.
Start the WSO2 ESB using the wso2server.bat/wso2server.sh from WSO2ESB_HOME\bin
Access the WSO2 ESB Management Console at https://localhost:9443/carbon
Start the ActiveMQ broker using activemq.bat/activemq.sh from ACTIVEMQ_HOME\bin
Access the Active MQ monitoring console to monitor the queue at http://localhost:8161/admin
There are two ways to create a proxy service.
- Using the WSO2 web console located at https://localhost:9443/carbon -> Services -> Add -> Proxy Service – This will be a UI based configuration
- Direct XML deployment. Create the proxy service xml and paste it to ESB_HOME\repository\deployment\server\synapse-configs\default\proxy-services for deployment.
Let’s take the second option. By the way after deploying the proxy service you should be able to trace the UI based configuration from the WSO2 web console. That’s another cool way of learning proxy configuration in WSO2 ESB.
Create an xml file with the following configuration. ( EntryQueue.xml )
<proxy xmlns="http://ws.apache.org/ns/synapse" name="EntryQueue" transports="https,http,jms"statistics="disable"trace="disable" startOnLoad="true"> <target> <inSequence> <send> <endpoint> <address uri="jms:/ExitQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/> </endpoint> </send> </inSequence> <outSequence> <drop/> </outSequence> <faultSequence/> </target> <parametername="transport.jms.ContentType"> <rules> <jmsProperty>contentType</jmsProperty> <default>text/plain</default> </rules> </parameter> <description></description> </proxy>
Note : The xml file name and the proxy service name should be same.
Deploy the proxy service by pasting the xml file at ESB_HOME\repository\deployment\server\synapse-configs\default\proxy-services ( ESB_Home is the home directory of WSO2 ESB)
Verify the successful deployment of the proxy service from the WSO2 web console. ‘EntryQueue’ proxy will be listed in Manage -> Services -> List
Figure 2: Deployed proxy services
Let’s test now by sending some sample messages to the EntryQueue. You can use the ActiveMQ web client for sending the messages.
- Queues can be monitored at http://localhost:8161/admin/queues.jsp
- Messaging client is located at http://localhost:8161/admin/send.jsp
Let’s send 10 messages to ‘EntryQueue’. After few second ‘ExitQueue’ will be created and the messages from ‘EntryQueue’ will be delegated to ‘ExitQueue’. You can verify this using the queue monitoring console. If you are familiar, you can use JConsole.
Figure 3: Queue monitoring
Hope it was helpful to start working on WSO2 ESB with a simple use case. Happy Integration !!