WSO2Event event formatter converts events coming from Siddhi in to wso2Event, according to the mapping configurations. Therefore, WSO2Event has three data types such as meta, correlation and payload. You can map the CEP back-end runtime event attributes to any one of the three data types by adding the mapping configuration under their type names.
You can configure through the management console as explained below or by manually adding an XML file as explained in step 5.
WSO2Event
mapping type. This drop-down list is populated based on the event adapter selected earlier. It lists only the mapping types supported by a particular event adapter. Some event adapters support multiple types of mappings.WSO2Event mapping, which you selected here, contains three types of data properties as meta data, correlation data and payload data. Each data property needs to have the following:
java.lang.String
, java.lang.Integer
, java.lang.Long
, or java.lang.Double
.Alternatively, you can specify an event formatter configuration using an XML file and save it in <PRODUCT_HOME>/repository/deployment/server/eventformatters
directory, which is the event formatter deployment directory. Since hot deployment is enabled, you can simply add/remove files to deploy/undeploy from the server.
Create the XML file with the following WSO2Event mapping event formatter configurations. Event formatter implementation must start with <eventformatter>
root element as in the example below.
<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>