Child pages
  • CEP Configuration Overview

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

There are 5 major components that need to be configured properly in order to set up CEP to process events. Those are:

1. Input Event Adapter

2. Event Builder

3. Event Processor

4. Event Formatter

5. Output Event Adapter

In addition to above, there is another component to manage event streams, named Stream Manager. Following diagram depicts the basic flow of events through the above mentioned components.

Even though there are many components to be configured, it is possible to quickly configure all these through one simple UI provided in the CEP management console. For advanced users who need more flexibility and control over the setup, it is possible to configure them separately too. In the coming few paragraphs, we'll walk through the process of creating an 'execution plan', which can be viewed as a runtime instance configuration of the CEP.

Note

In the below sections, we'll be going through the process of configuring streams and execution plans using the CEP web management console. In addition it is also possible to do the same by creating and deploying the required configuration files in the file system, which is not explained in the below sections. For more information on this approach, please refer to the relevant documentation in the User Guide.

Creating Event Adapters

Event adapters can be defined to receive events from a source or to send events to a sink using various transport or persistence mechanisms (such as JMS, Thrift, Cassandra etc). An event adapter can be defined through the Configure → Event Processor Configs in the management console which is usually available at https://localhost:9443/carbon.

Depending on the Event adapter type you choose, you will have to enter the relevant details of the adapter. For additional information on how to define an event adapter, please refer to the user guide on Event Adapters.

Defining Event Streams

Event Streams are a core part of CEP configuration. When configuring an execution plan, one or more streams are required for inputs and outputs. A typical stream definition contains meta information (such as attribute names, data types etc) that are required to identify and fetch the fields/data from a given event.

A new event stream can be defined from the CEP management console through Main menu -> Event Processor -> Event Streams -> Add Event Stream

In the stream attributes section, there are three types of attribute definition options.

  • Meta data : meta information related to the stream
  • Correlation data : data required to correlate between different points/entities
  • Payload data : all other data to be processed

For additional information on streams refer to the documentation on working with event streams

Creating an Execution Plan

In the management console, under the main menu, there's a menu item named Execution Plans which will direct you to a page that contains a link to create an execution plan and lists existing execution plans. To create a new execution plan, click Add Execution Plan, which pops up a window as follows.

Fill in this form with basic details such as execution plan name etc. The Siddhi Configurations section contains advanced setup options such as persisting periodical snapshots and distributed processing. Leave them as they are for now.

Under the Query Expressions section you will find a subsection for imported streams. Imported streams are the ones that feed incoming events to the processing engine of the CEP. In the 'import stream' dropdown, you can see the already defined streams and a 'Create Stream Definition' menu item which lets you define a new stream. If you have already defined streams using as described in the previous section, you can proceed by choosing them. Otherwise it is also possible to create a new stream definition using the 'Create Stream Definition option without navigating back to the Stream Definitions menu.

Once you finish creating the required streams, you can proceed to import them to the Siddhi processing engine with the required alias (using 'As' field) as follows:

When a stream is imported successfully, it is displayed underneath the import section with the Siddhi query syntax as follows:

Once queries are added, you have to export the relevant streams so that CEP can output events. In the 'Value of' field, type in the correct stream name and then click 'Create Stream Definition' under the 'Stream Id' dropdown. This will popup a window with some default values.

After adding the exported streams, you can proceed to save the execution plan.

Creating Custom Event Builders

In the above section, we continued to define the execution plan without going through the advanced configuratio options such as defining custom mappings. An event builder is responsible for converting from different input formats (such as XML, WSO2 Event, Maps) to a unified format that is supported by the processing engine.

A custom event builder can be defined from the 'Create Execution Plan' window itself (through 'Create Event builder' that is available under the 'Imported Streams' subsection) or by Configure → Event Processor Configs → Event builders

Creating Custom Event Formatters

An event formatter is responsible for converting the unified events received from the processing engine to various other event formats such as XML, JSON and Maps.

A custom event formatter can be defined from the 'Create Execution Plan' window itself (through 'Create Event Formatter' which is available through the 'Exported Events' section) or by Configure → Event Processor Configs → Event Formatters.

  • No labels