Event Formatter

Configuring WSO2Event Event Formatter

This will convert the events which coming from Siddhi in to wso2Events according to the mapping configurations.

Hence WSO2Event has three data types (Meta, Correlation and Payload), the CEP back end runtime event attributes can be mapped to any one of them by adding the mapping configuration under their type names.

Configuring through the Management Console UI

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 Formatter menu.

2. The Create a New Event Formatter window opens, using which you can configure new event formatters. Enter the following details in the form to create a wso2Event mapping based event formatter as shown in the screenshot below.


Create Event Formatter

Here, there are several properties that need to be filled when creating a event formatter. User interface is divided in to 3 main components (From, Mapping and To) except the event formatter name to give more understanding to the user.

WSO2Event Mapping

WSO2Event contains three types of data properties. They are Meta Data, Correlation Data and Payload Data. Each data property needs to have

3. After adding details click the Add Event Formatter button. The Available Event Formatter page will open. To view event formatter configurations, click on the event formatter name. To delete event formatter, click the Delete button.


Create Event Formatter


Editing Event Formatter Configuration through the Management Console

By Clicking the Edit button of the relevant event formatter, you will able to edit the event formatter configuration and redeploy it. When you click the Edit button, it will redirect to a xml based editor window which allow you to edit the event formatter configuration from UI without opening the configuration file in the file system.


Create Event Formatter

Configuring through a xml File

You can specify a event formatter configuration through in a xml file and deploy it in the deployment directory in the server. Event Formatter deployment directory is available at <CARBON_HOME>/repository/deployment/server/eventformatters . This is an hot deployment directory, then it is easy to deploy and undeploy an event formatter configuration.

1. Create a xml file and enter the following WSO2Event mapping event formatter configurations inside the above mentioned hot deployment directory. Event formatter implementation needs to be start with "eventformatter" root element.

<eventFormatter name="StatisticsFormatter" xmlns="http://wso2.org/carbon/eventformatter">
        <from streamName="statisticsStream" version="1.0.0"/>
        <mapping type="wso2event">
            <metaData>
                <property>
                    <from name="ipAddress"/>
                    <to name="ipAdd" type="string"/>
                </property>
            </metaData>
            <payloadData>
                <property>
                    <from name="user"/>
                    <to name="username" type="string"/>
                </property>
            </payloadData>
        </mapping>
        <to eventAdaptorName="wso2EventSender" eventAdaptorType="wso2event">
            <property name="stream">statisticsOutStream</property>
            <property name="version">1.0.0</property>
            </to>
    </eventFormatter>

For more details on creating different types of event formatters, Please refer the official documentation Here.