BAM Mediator is a mediator for WSO2 ESB that captures data events from the ESB mediation sequences and send to the BAM server. BAM server receives data events via its Thrift API. This protocol uses a binary protocol and enables fast data transmission between the ESB and BAM server.
The BAM mediator can be configured early. The data to be extracted from ESB configuration context can be pre-configured. In the configuration panel, the user can specify the BAM server (Thrift server) related information in the BAM Server Profile. In each BAM Server Profile, the user should define a set of event streams that can be used at the BAM mediator declaration time. When a BAM mediator is declared in an ESB sequence, the user has to select a BAM Server Profile from the given list and a Stream (uniquely identified by a name and a version) available in the selected BAM Server Profile.
1. Download WSO2 ESB version 4.5.x or later from http://wso2.com/products/enterprise-service-bus. Since
BAM Mediator Aggregate feature is available by default from ESB 4.6.0 onwards, you do not have to install it separately if you use a newer ESB version.
2. Since both ESB and BAM server will be run concurrently, change the port number of ESB by applying an offset. To apply an offset, navigate to <ESB_HOME>/repository/conf and open file, carbon.xml, where <ESB_HOME> is the WSO2 ESB's product distribution directory. Then change the value in xpath Server/Ports/Offset from 0 to some other integer. For example,
3. To the WSO2 ESB server,
on MS Windows, run <ESB_HOME>/bin/wso2server.bat
4. After starting the server, log in to ESB's management console and select menu "Configure -> Features -> Repository Management" menu. Add a new P2 repository through either through a URL or from a file system. For more information on adding a P2 feature repository, refer to section Managing the Feature Repository.
5. Once done, navigate to "Available Features" tab and select the repository added in the previous step. Click the "Find Features" button. It will take a while to list out all the available features in the feature repository. Once listed, select "BAM Mediator Aggregate" feature. If you can't see "BAM Mediator Aggregate feature", retry with one of the following suggestions:
6. Once the feature is selected, click "Install" link and proceed with the installation. For more information on feature installation, refer to section Installing Features.
7. Once the installation is completed, restart the WSO2 ESB server.
There are few configurations that need to be done before using a BAM Mediator in a mediation sequence. When editing a mediation sequence, the user can only use the existing BAM Mediator configurations. These steps are explicitly described for a sample in the following sections.
Before adding a BAM mediator to a mediator sequence, BAM mediator configurations should be updated as below. Configuration information are basically considered as a set of BAM server profiles, which contains transport and credential data required to connect to the BAM server. In each BAM server profile, one or many Event Stream configurations should be defined. Streams contain Thrift API event-stream-related information like Stream Name, Stream Version etc. and data to be extracted from the configuration context of the mediation sequence.
1. Navigate to the ESB management console and select menu "Configure -> BAM -> Server Profile".
2. If there are no existing Profiles, add one using the "Add Profile" link.
3. If there are Profiles already existing, you can edit them using the "Edit Profile" link. If there are unnecessary profiles, they can be deleted using the "Remove Profile" link.
4. Enter the profile information shown in the following example,
5. Then, you can define a set of Stream Configurations among which the required Stream Configuration can be selected in the mediator definition time. Each Stream Configuration must have,
When editing a stream, check on "Dump header" or "Dump body," if you want to record SOAP header or SOAP body of messages respectively. In "Stream Properties" the user can extract several types of properties from the message. Basically, Stream Properties are divided into two.
6. After "Stream Payload" and "Stream Properties" are added/edited, click the "Update" icon to reflect changes in the specific Stream Configuration. Next, click the "Add" icon to add the new Stream Property to the properties list. The "Cancel" button ignores the updated Stream Properties data.
7. After the changes are properly made to the BAM Server Profile, click on "Save" button to save all the configuration data to the secondary storage.
In order to test the functionality of the BAM mediator user can define a sample WSDL Proxy Service. Before creating that service the user needs to create an Endpoint service to the WSDL Proxy Service. Here are the steps to create an Endpoint service.
These are the steps to create a sample WSDL Proxy Service to test the BAM mediator.
After creating a sample WSDL Proxy Service, the user can add one or more BAM mediators to the sequence of WSDL Proxy Service as follows.
<streamConfig name="stream1" version="1.0.0" ></streamConfig>
At the moment all above mentioned steps should be finished to test the BAM mediator. In this step the user can send custom messages through the previously created WSDL Proxy Service and test whether they are correctly stored in the Cassandra database. This is only an example but the same type of steps can be followed to use the BAM mediator in the production environment.
ant stockquote -Daddurl=https://localhost:8244/services/Simple_Stock_Quote_Service_Proxy -Dmode=fullquote -Dsymbol=testString
(Here addurl value should be given from the https endpoint located in Simple_Stock_Quote_Service_Proxy's service dashboard that can be navigated by going to the ESB management console Main→Web Services→List from side panel and selecting Simple_Stock_Quote_Service_Proxy. Any preferred string can be used instead of the testString for symbol )
Now BAM mediator in the proxy service, Simple_Stock_Quote_Service_Proxy should have dumped data extracted from the ESB to the key-space, EVENT_KS in the Cassandra database, with column family name same as the Stream Name. Data in the Cassandra database can be seen from the Cassandra Explorer in the BAM server.