This sample demonstrates how to set up an execution plan with a quartz scheduler based cron window for generating periodic alerts on build failures.
The execution plan used in this sample is as follows:
The first query,
- Receives events through the
- Adds events that satisfy the condition
isBuildFailed == trueto a cron window. The cron window is configured to output at 1 am every day using the cron notation.
- Selects the attributes
- The group by clause causes the count() to be calculated per project.
- Outputs events to the
Building the sample
Start the WSO2 DAS server with the sample configuration numbered 0115. For instructions, see Starting sample CEP configurations.
This sample configuration does the following:
- Points the default Axis2 repo to
<DAS_HOME>/samples/cep/artifacts/0115(by default, the Axis2 repo is
Executing the sample
Open another terminal, go to
<DAS_HOME>/samples/cep/producers/httpand run the following command:
ant -Durl=http://localhost:9763/endpoints/buildStatisticsEventReceiver -Dsn=0115
It builds the http client and publishes the events at
You can see the events getting received by DAS by the logs in its console.
The above query will output the processed events at "1 am" as defined in the execurion plan. You can edit the query in "BuildFailureStatisticsPlan.siddhiql" file which is located in the
<DAS_HOME>/samples/cep/artifacts/0115/executionplans directory to reschedule as per requirement.
Below is an example of a scheduler related query which outputs processed events on 5th minute each hour. For more information see Inbuilt Windows.