Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

WSO2 CEP uses Execution Plans to store event processing logic. An Execution Plan is bound to an instance of the Siddhi complex event processing runtime, which is responsible for the actual processing of the events. The event processor allows users to configure multiple Execution Plans where by providing multiple isolated event processing environments per Execution Plan. A typical Execution Plan consists of a set of queries and related input and output Event Streams.

...

Configuring Execution Plan

  1. Start the CEP, log in to its management console, go  go to Main --> Manage --> Event Processor --> Execution Plans and click Add Execution Plan.
  2. Enter details in the form that appears, as given bellow;

    An execution plan consists of the following:
    Table of Contents
    minLevel4

    Execution Plan Info


    • Execution Plan Name : The name of the Execution Plan can contain only alphanumeric characters and '_' character
    • Description : Description for the execution plan.

    Siddhi runtime configurations

    These configuration parameters are specific to the underlying Siddhi runtime. The parameters currently supported are as follows:


    • Snapshot interval : The time interval in which periodic snapshots of the event processing state is taken. Use 0 to disable snapshots. This parameter enables the application to recover from server crashes.
    • Distributed processing : Allows Redundant-Node  and Distributed-Cache based distributed event processing.

     

    Warning

    If you enable snapshot (by adding value other than 0), please start the CEP sever with the embedded Cassandra. This is needed because, by default, Cassandra is disabled in CEP to avoid processing overhead. To start CEP with embedded Cassandra, use the below command.

    ./wso2server.sh -Ddisable.cassandra.server.startup=false


    Query expressions

    Contains the event processing logic written in Siddhi query language . When defining more than one query, each query should end with a semi colon. 

    Import streams

    Defines the mappings between the available Event Stream to the imported (input) stream of the Siddhi runtime (defined inside query expressions). The parameters are as follows:

    • StreamId Import Stream : The name of the CEP Event Stream 's id which feeds the which will feed its events to the Execution Plan. 
    • As : The name to be used when feeding the stream to the Siddhi engine. This can contain only alphanumeric characters and underscore (_). 

    Export streams

    Defines the mappings between the exported (output) stream of the Siddhi runtime to one of the available Event Streams (defined inside query expressions). The parameters are as follows:

    • Value Of : The name of the stream exposed by the Siddhi runtime. This can contain only alphanumeric characters and underscore (_).
    • StreamId : The CEP Event Stream's id to which the output events are sent from the Execution Plan.
    Info
    • It is not mandatory to define export streams in an execution plan.
    • Siddhi Event tables cannot be exposed as streams. Event tables are only considered as streams within Siddhi.

    Finally click the Add Execution Plan button to deploy the Execution plan. 

  3. After an execution plan is successfully created, you can change its configuration and redeploy it by clicking the Edit link associated with it. You can also click other associated links to delete it, enable/disable statistics or enable/disable tracing.

  4. An XML based editor opens allowing you to edit the Execution Plan configuration from the UI itself. Do your modifications and click Update.

  5. Alternatively, you can specify an Execution Plan configuration using an XML file and save it in the Execution Plan deployment directory <PRODUCT_HOME>/repository/deployment/server/executionplans. Since hot deployment is supported you can simply add/remove Execution Plan configuration files to deploy/undeploy Execution Plans from the server.

    To add Execution Plan via configuration file, create an XML file with the following Execution Plan configurations and add that to the Execution Plan deployment directory. Note: Execution Plan configuration must start with  <executionPlan> root element.

    Code Block
    languagehtml/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <executionPlan name="searchStatsAnalyzer" statistics="disable"
      trace="disable" xmlns="http://wso2.org/carbon/eventprocessor">
      <description>Search statistics analyzer</description>
      <siddhiConfiguration>
        <property name="siddhi.enable.distributed.processing">false</property>
        <property name="siddhi.persistence.snapshot.time.interval.minutes">0</property>
      </siddhiConfiguration>
      <importedStreams>
        <stream as="SearchStats" name="org.foo.data.search.stats" version="1.0.0"/>
      </importedStreams>
      <queryExpressions><![CDATA[from SearchStats#window.time(60 min)
    select meta_ip, userName, count(userName) as requestCount
    group by  meta_ip, userName
    insert into OutStats;]]></queryExpressions>
      <exportedStreams>
        <stream name="org.foo.data.out.stats" valueOf="OutStats" version="1.0.0"/>
      </exportedStreams>
    </executionPlan>