This will convert the events/streams from an Input Adaptor that supports WSO2-Events into an event stream that is compatible with the Event Processor.
WSO2-Event has three data types (Meta, Correlation and Payload), which can be mapped to CEP back-end runtime event attributes by specifying the mapping in the event builder.
1. Log in to the CEP management console and select the Main menu in the left hand side of the screen. Then select the Add menu item under Event Builder menu.
2. The Create a New Event Builder window opens, using which you can configure new event builders. Enter the following details in the form to create an WSO2-Event based event builder as shown in the screenshot below.
In this UI, there are several properties that need to be filled when creating an event builder. The user interface is divided in to 3 main components (From, Mapping and To) and all properties come under a specific section (except the event builder name) to make it more understandable.
By Clicking the Edit button of the relevant event builder, you will able to edit the event builder configuration and redeploy it. When you click the Edit button, it will redirect to an XML based editor window which will allow you to edit the event builder configuration from UI without opening the configuration file in the file system.
Click Update after editing the configuration to save the changes and redeploy.
You can specify a event builder configuration through an xml file and deploy it in the deployment directory of the server. Event Formatter deployment directory is available at <CARBON_HOME>/repository/deployment/server/eventbuilders . This is a hot deployment directory, where the event builder will be automatically undeployed and deployed when you save the changes to the file system.
1. Create an XML file and enter the following WSO2Event based event builder configurations inside the above mentioned hot deployment directory. Event builder implementation needs to start with "eventbuilder" root element and its default namespace should be set to http://wso2.org/carbon/eventbuilder as in the example below.
<?xml version="1.0" encoding="UTF-8"?> <eventBuilder name="SearchStatBuilder" xmlns="http://wso2.org/carbon/eventbuilder"> <from transportAdaptorName="localEventReceiver" transportAdaptorType="wso2event"> <property name="stream">access_Analytics</property> <property name="version">1.0.0</property> </from> <mapping type="wso2event"> <property> <from dataType="meta" name="ipAdd"/> <to name="ipAddress" type="string"/> </property> <property> <from dataType="payload" name="username"/> <to name="username" type="string"/> </property> <property> <from dataType="payload" name="keywords"/> <to name="searchTerms" type="string"/> </property> </mapping> <to streamName="searchStatistics" version="1.0.0"/> </eventBuilder>