So your WSO2 ESB is running smoothly in your SOA architecture and all sorts of data are flowing from one application to another? Great! Knowing exactly what is happening ‘under the hood’ can help you make business decisions on a daily basis. That is where WSO2s Data Analytics Server comes in: by gathering and analyzing useful information on performance, usage and events, DAS will provide you with useful insights through its user-friendly dashboards.
In this blog we will show you how to capture data from WSO2 ESB events and get information on analytics from your service bus. In order to illustrate our story, we will use the VFS transport protocol, so make sure you have it enabled in your WSO2 ESB Server.
This example will explain:
- How to set up WSO2 ESB to send information to the Data Analytics Server
- How to tell WSO2 DAS which data it can expect and where to store it
- How to make WSO2 DAS analyze your data
- How to Publish the analyzed data
Before we start, do not forget to change the port offset in one of the products if they are running on the same server. All set? Let us get into some details:
- ESB: Enabling VFS transport:
Let’s change the transport Sender and Receiver in ESB_HOME/repository/conf/axis2/axis2.xml:
<transportReceiver name=”vfs” class=”org.apache.synapse.transport.vfs.VFSTransportListener”/>
<transportSender name=”vfs” class=”org.apache.synapse.transport.vfs.VFSTransportSender”/>
- ESB: Setting up BAM Server Profile:
Configure the BAM Server Profile and setup to your DAS Server as showing below:
In stream configuration field, let us set the fields for our message and environment variables:
In this scenario, we will just get the fields origin and destination from the XML message file and the context variable which identifies the flow (business.flow).
- ESB: Writing the proxy service
For this example, we will use this custom proxy:
Looking to the proxy sourcecode, we have the exactly reference for the BAM Profile we have created in step 2. In this example, everytime the proxy get a xml file in the transport.vfs.FileURI, it will send data to DAS in inSequence and faultSequence.
- DAS: Creating the stream
In the DAS, we don’t need to create the stream manually as ESB will create automatically in the first request to the proxy. Below we can see what happens when I send the first request from DAS:
Checking in DAS Event Streams, we can see the event created:
- DAS: Getting the information to the database
To record the information in the stream, we have to edit the stream and check what fields we’d like to have in the table.
Now we should have the table created.
- DAS: Creating a Receiver (Almost there)
If we use the proxy now, it will not work instantly, as we can see below:
To get the data from the event stream, it is required to create an event receiver:
Going to Main/Event Receivers, let’s choose the input event adapter type as wso2event and we need to select the event stream we want to receive the messages for, in our case ESBstreamDAS:1.0.0.
Looking to the log, we will get the following:
- DAS: Finally the data
Sending the request from the proxy again, we can see the records in the table:
I can hear you think: kay, so I have just created a table, so what?
- DAS: Getting the graphics
So let us have some fun with this data: using DAS’s dashboard server we can create appealing report dashboards including “gadgets”.
Select the stream:
Chart type:
And the axis:
And there it goes:
If we look back on the event flow, we can see the map of different streams connector:
In this simple example you learned how to use the BAM Mediator from WSO2 ESB to send event information to WSO2 Data Analytics Server. There is a lot to explore in event publishing and even more in how to analyze your information. Are you interested in how Data Analytics can help you make decisions based on facts? Feel free to contact us!
Read also our other WSO2 tutorials and blogs, written by our WSO2 Gurus. In case you need WSO2 support, contact the Yenlo WSO2 Guru team to get WSO2 Development Support or WSO2 Operational Support. Of course we do deliver excellent WSO2 training services as well, based on reallife WSO2 tutorials.
Thanks to Domenique Mulder for his contribution to this blog.