Versions Compared

Key

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

Domain-specific execution manager feature in WSO2 CEP that provides management of execution plan templates. It lets you customize, and preconfigured domain-specific execution parameter values in an user friendly dashboard. The dashboard allows you to configure these parameter values through available domain templates. 

Generally, you need to edit edit an execution plan by writing the required Siddhi queries, if you want to monitor to monitor a specific event flow or modify a parameter value in WSO2 CEP. However, with this execution manager feature, you can you can focus on the query combinations by visualizing Siddhi queries with the help of the available template structures. With this feature you can you can identify a combination of choices to obtain the desired output stream of events.

Following topics describe the functionality of the domaindomain-specific execution manager feature.

Table of Contents
maxLevel3

Creating a template

You need to create template configurations specific to your domain in a XML file, and place them in the <CEP_HOME>/repository/conf/cep/domain-template/ direcotory directory, to  to use the execution manager and populate the Siddhi Queries. By default, WSO2 CEP contains a sample domain named TemperatureAnalysis. Following is an example template configuration file specific for this TemperatureAnalysis domain. 

You can have one or more templates in a domain. Each template has an execution plan with a set of parameters for that execution plan which you can configure. 

Code Block
languagexml
<templateDomain name="TemperatureAnalysis">
  <description>Temperature Analysis Description</description>
  <templates>
    <template name="Maximum Temperature">
      <description>To check maximum room temperature of all rooms</description>
      <executionPlan><![CDATA[
                                /* Enter a unique ExecutionPlan */
                                @Plan:name('testPlan')
                
                                /* Enter a unique description for ExecutionPlan */
                                -- @Plan:description('ExecutionPlan')
                
                                /* define streams and write query here ... */
                
                                @Import('inStream:1.0.0')
                                define stream inStream (meta_temperature double, meta_roomNumber int);
                
                                @Export('outStream:1.0.0')
                                define stream outStream (meta_temperature double, meta_roomNumber int);
                
                                from inStream[meta_temperature > $maxVal]
                                select meta_temperature,meta_roomNumber
                                insert into outStream;
                                 ]]></executionPlan>
      <parameters>
        <parameter name="maxVal" type="int">
          <displayName>Maximum Temperature</displayName>
          <description>Maximum room temperature threshold</description>
          <defaultValue>75</defaultValue>
        </parameter>
      </parameters>
    </template>
  </templates>
  <streams>
    <stream>
                        {
                        "streamId": "inStream:1.0.0",
                        "name": "inStream",
                        "version": "1.0.0",
                        "nickName": "",
                        "description": "",
                        "metaData": [
                        {
                        "name": "temperature",
                        "type": "DOUBLE"
                        },
                        {
                        "name": "roomNumber",
                        "type": "INT"
                        }
                        ],
                        "correlationData": [],
                        "payloadData": []
                        }
                    </stream>
    <stream>
                            {
                            "streamId": "outStream:1.0.0",
                            "name": "outStream",
                            "version": "1.0.0",
                            "nickName": "",
                            "description": "",
                            "metaData": [
                            {
                            "name": "temperature",
                            "type": "DOUBLE"
                            },
                            {
                            "name": "roomNumber",
                            "type": "INT"
                            }
                            ],
                            "correlationData": [],
                            "payloadData": []
                            }
                        </stream>
  </streams>
</templateDomain>

Configuring the execution plan 

The execution plan is deployed in a template in WSO2 CEP, once you save a configuration for the first time. You can modify the name specified in the execution plan, and re-deploy it by adding a configuration name. For more information on execution plans, see Creating a Standalone Execution Plan.

Name the configurable the configurable parameters of the Siddhi query in query in the execution plan  by using the “$” character. For example, in  in the sample query below, $timeIntervel and $maxVal are the configurable parameters which should be defined within the <parameters> element of the template.      

Code Block
languagetext
 from inStream#window.time($timeInterval)
 select avg(temperature) as temperature, roomNumber
 group by roomNumber
 having temperature>= $maxVal
 insert into outStream;

Configuring the parameters 

A template can have one or more parameters. You can set a display name and a description to show in the user interface. Also, you can set a default value if required. If the input values need to be limited to a defined set of values, define the options as comma-separated values. These values are shown in a drop down list in the user interface. An example configuration of example configuration of a set of parameters is shown below.

...

Configuring the event streams

You can have one or more event streams in a domain template. Define  Define the required event streams within the <streams> element of the domain template.   The input and output event streams that are defined in the template are deployed in WSO2 CEP, once you save a configuration for the first time. For information on defining event streams, see /wiki/spaces/TESB/pages/32604253. An  An example  configuration  of event streams is shown below.

Code Block
languagexml
<streams>
        <stream>
            {
            "streamId": "inStream:1.0.0",
            "name": "inStream",
            "version": "1.0.0",
            "nickName": "",
            "description": "",
            "metaData": [
            {
            "name": "temperature",
            "type": "DOUBLE"
            },
            {
            "name": "roomNumber",
            "type": "INT"
            }
            ],
            "correlationData": [],
            "payloadData": []
            }
        </stream>
        <stream>
            {
            "streamId": "outStream:1.0.0",
            "name": "outStream",
            "version": "1.0.0",
            "nickName": "",
            "description": "",
            "metaData": [
            {
            "name": "temperature",
            "type": "DOUBLE"
            },
            {
            "name": "roomNumber",
            "type": "INT"
            }
            ],
            "correlationData": [],
            "payloadData": []
            }
        </stream>
    </streams>

Execution manager dashboard

Use the  execution manager dashboard to do the configurationsconfigurations.  

Follow the steps below to use the execution manager dashboard.

  1.  Log in to the management console using the following URL: https://<CEP_HOST>:<CEP_PORT/carbon/
  2. Click Main, and then click Execution Manager under the Manage menu.   You view the dashboard home page with the available domains as shown below.
    homepage of the execution manager dashboardImage Modified
  3. Click on the domain, which you need to configure. 
  4. Click Add Configuration to add a new a new configuration to the selected domain as shown below.
    add a new configuration to the selected domainImage Modified
  5.  Enter a desired Configuration Name, Description, and values for the Parameter Configurations for the  template template configuration information as shown below.
    specifying the details of the configurationImage Modified
  6. Click Add Configuration. You view a pop-up message on successful addition of the configuration as shown below.
    pop-up message on successful addition of a new configurationImage Modified
  7. Close the pop-up message.   You view the new configuration in the list of tall available configurations of the selected domain as shown below. You can edit or delete it using the corresponding options provided.
    list of the available configurations of the selected domain

    An execution plan with the configured parameters gets deployed, once once you save the configuration. Follow the steps below to view this new execution plan.

  8. Log in to the management console using the following URL, if  if you are not already logged in:   https://<CEP_HOST>:<CEP_PORT/carbon/

  9. Click Main, and then click Execution Plans under the Event Processor menu.   You view the new execution plan added to the list of available execution plans as shown below.

    list of all available execution plansImage Modified

  10. Click on the name of the execution plan.   The parameters you entered are applied to the execution plan as shown below.

    parameters of the execution planImage Modified

    The required event streams defined in the execution plan also gets deployed, o nce you save the configuration. Follow the steps below to view the event streams.

  11. Log in to the management console using the following URL, if you are not already logged in: https https://<CEP_HOST>:<CEP_PORT/carbon/

  12. Click Main, and then click Execution Streams under the Event Processor menu. You view the deployed event streams in the list of available of available event streams as shown below.

    new event streams added to the list of all available event streams