This documentation is for WSO2 CEP 3.0.0. View the home page of the latest release.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

WSO2Event Event Builder converts 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 the CEP backend runtime event attributes by specifying the mapping in the event builder. 

You can configure through the management console as explained below or by manually adding an XML file as explained in step 7.

  1. Log in to the CEP management console, select Event Builders and click Add Event Builder.
  2. Enter details in the form that appears and click the Add Event Builder button at the end of the form. For example,

The fields in the above configuration are as follows:

  • Event Builder Name : Property to uniquely identify a event formatter configuration
  • Input Event Adaptor (marked as 1 in the screenshot) : The input event adaptor used to publish events to the CEP. This drop-down list only displays the adaptors that are already created.
  • Input Event Adaptor properties (marked as 2 in the screenshot) : Properties required by the input event adaptor depending on the input event adaptor type selected before. For example, if you select WSO2Event based input event adaptor, then the required properties are as follows:
    • Stream Definition - The stream name of the incoming WSO2Event stream
    • Stream Version - The version of the incoming stream
  • Input Mapping Type (marked as 3 in the screenshot): This property changes based on the event adaptor selected. It lists only the mapping types supported by a particular event adaptor. For example, if you select WSO2Event mapping as the adaptor type, then the mapping type will be wso2event.
  • Mapping properties (marked as 4 in the screenshot) : Map the incoming stream to the outgoing stream received by the event processor. In the example above, mappings are further divided as meta data, correlation data and payload data. Map an incoming stream attribute to an outgoing stream attribute. For example, to add a mapping to payload data attribute, go to the row for adding a payload data and,
    • Enter the attribute name of the incoming stream in Input Attribute Name
    • Enter the attribute name for the outgoing stream in Mapped To
    • Select the data type of the attribute from the To Stream Data Type drop down
    • Click Add to add the individual attribute mapping to the event builder
  • To Stream Name/Version : Stream name/version of the outgoing stream
3. After adding the relevant details click the Add Event Builder button. The Available Event Builders page will open. To view event builder configurations, click on the event builder name. To delete an event builder, click the Delete button.


Editing Event Builder Configuration through the Management Console

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.

Configuring through an XML File

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>




 

 

  • No labels