Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WSO2 CEP uses Execution Plans to store these complex event processing logics it processlogic. An Execution Plan is bind 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 a set of queries and related input and output Event Streams.

...

  1. Start the CEP, log in to its management console, 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 PlanCan 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 the event processing state is taken. Use 0 to disables 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 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

    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 : The CEP Event Stream's id which feed the events to the Execution Plan.
    • As : The name to be used when feeding the stream to the Siddhi engine. This can contain only alphabetical characters, numerics and underscore (_). 

    Query expressions

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

    Export streams

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

    • ValueOf : The name of the stream exposed by the Siddhi runtime. This can contain only alphabetical characters, numerics 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 exported streams in an execution plan.
    • Siddhi Eventables connot be exposed as streams. Eventables is only considered as streams with in 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 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>