WSO2 DAS uses execution plans to store event processing logic. An execution plan is bound to an instance of Siddhi the Siddhi Data Analytics Server runtime, which is responsible for the actual processing of events. DAS allows users to configure multiple execution plans and provides 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.
Writing an execution plan
Follow the instructions below to write an execution plan.
- Start WSO2 DAS and log into its Management Console. Click Main and then click Execution Plans to open the Available Execution Plans page.
Click Add Execution Plan to open the Create a New Execution Plan page in which a template is displayed as shown in the example below.
You can edit this template to create a new execution plan. Follow the steps below to edit the template and create a new execution plan.Info The execution plan editor supports auto completion.
To view the suggestions made by the editor, press control+space keys together.
The suggestions contain two sets.
- Siddhi keywords, in alphabetical order
- All the other words which are already inserted into the editor. For example, stream names which are defined in step 2 will be suggested when writing the queries in step 3. These will appear in alphabetical order after the keyword list.
In addition to the above, press shift+2 keys together to view suggestions on annotations.
Step 1: Add execution plan info
Add Execution Plan Name
Give a meaningful name to the execution plan by replacing ExecutionPlan
in @Plan:name('ExecutionPlan')
with the new name.
For example, if the new name should be 'NewExecutionPlan'
, then replace @Plan:name('ExecutionPlan')
with @Plan:name('NewExecutionPlan')
.
Description
This is the description of the execution plan. Giving a description is optional.
...
For example, @Plan:description('This is the description for my NewExecutionPlan')
.
Step 2: Import streams
Info |
---|
An execution plan processes one or more streams. Therefore it is mandatory to import streams into an execution plan. Importing a stream means mapping an available event stream to another internal stream. This internal stream is then used in query expressions, which will be written in Step 3: Add query expressions. This internal stream is meant to be used by the Siddhi runtime. |
...
This will import an available event stream as a new stream.
Step 3: Add query expressions
Query expressions are event processing logic written in Siddhi Query Language. When defining more than one query, each query should end with a semi colon.
Step 4. 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 ID of the event stream to which the output events are sent from the execution plan.
Info |
---|
|
Step 5. Add execution plan
Before adding the execution plan to the Siddhi runtime, it can be validated by clicking Validate Query Expressions.
Click Add Execution Plan to deploy the execution plan.
Editing a deployed execution plan
Follow the procedure below to edit an execution plan.
- Start WSO2 DAS and log into its Management Console. Click Main and then click Execution Plans to open the Available Execution Plans page. The available execution plans are listed in this page.
- Click Edit in the row of the execution plan you want to edit. The Edit Execution Plan Configuration page will open.
- Edit the execution plan as required and click Update.
Info |
---|
Alternatively, you can write your execution plan in a text file and save it with the |
Deleting a deployed execution plan
Follow the procedure below to delete an execution plan.
- Start WSO2 DAS and log into its Management Console. Click Main and then click Execution Plans to open the Available Execution Plans page. The available execution plans are listed in this page.
- Click Delete in the row of the execution plan you want to delete. Click Yes in the message which appears to confirm whether the execution plan should be deleted.