This repository has been archived by the owner on Oct 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sample added for Siddhi event triggers
- Loading branch information
Showing
9 changed files
with
221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This sample uses | ||
EventPublisher: logger | ||
|
||
Producers: event simulator | ||
Consumers: console |
9 changes: 9 additions & 0 deletions
9
modules/samples/artifacts/0119/eventpublishers/cronTriggeredSensorStreamLogger.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<eventPublisher name="cronTriggeredSensorStreamLogger" | ||
statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher"> | ||
<from streamName="cronTriggeredSensorStream" version="1.0.0"/> | ||
<mapping customMapping="disable" type="text"/> | ||
<to eventAdapterType="logger"> | ||
<property name="uniqueId">cron</property> | ||
</to> | ||
</eventPublisher> |
9 changes: 9 additions & 0 deletions
9
modules/samples/artifacts/0119/eventpublishers/periodicalTriggeredSensorStreamLogger.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<eventPublisher name="periodicalTriggeredSensorStreamLogger" | ||
statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher"> | ||
<from streamName="periodicalTriggeredSensorStream" version="1.0.0"/> | ||
<mapping customMapping="disable" type="text"/> | ||
<to eventAdapterType="logger"> | ||
<property name="uniqueId">periodical</property> | ||
</to> | ||
</eventPublisher> |
4 changes: 4 additions & 0 deletions
4
modules/samples/artifacts/0119/eventsimulatorfiles/events.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
199008131245,false,100,temperature,23.45656,7.12324,100.34,23.4545 | ||
199008131245,true,101,temperature,23.45656,7.12324,100.34,23.4545 | ||
199008131245,false,103,temperature,23.45656,7.12324,100.34,23.4545 | ||
199008131245,true,104,temperature,23.45656,7.12324,100.34,23.4545 |
24 changes: 24 additions & 0 deletions
24
modules/samples/artifacts/0119/eventsimulatorfiles/events_streamConfiguration.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><!-- | ||
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
~ | ||
~ WSO2 Inc. licenses this file to you under the Apache License, | ||
~ Version 2.0 (the "License"); you may not use this file except | ||
~ in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
|
||
<streamConfiguration type="csv"> | ||
<file>events.csv</file> | ||
<streamID>org.wso2.event.sensor.stream:1.0.0</streamID> | ||
<separateChar>,</separateChar> | ||
<delayBetweenEventsInMilies>1000</delayBetweenEventsInMilies> | ||
</streamConfiguration> |
48 changes: 48 additions & 0 deletions
48
modules/samples/artifacts/0119/eventstreams/cronTriggeredSensorStream_1.0.0.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "cronTriggeredSensorStream", | ||
"version": "1.0.0", | ||
"nickName": "", | ||
"description": "", | ||
"metaData": [ | ||
{ | ||
"name": "timestamp", | ||
"type": "LONG" | ||
}, | ||
{ | ||
"name": "isPowerSaverEnabled", | ||
"type": "BOOL" | ||
}, | ||
{ | ||
"name": "sensorId", | ||
"type": "INT" | ||
}, | ||
{ | ||
"name": "sensorName", | ||
"type": "STRING" | ||
} | ||
], | ||
"correlationData": [ | ||
{ | ||
"name": "longitude", | ||
"type": "DOUBLE" | ||
}, | ||
{ | ||
"name": "latitude", | ||
"type": "DOUBLE" | ||
} | ||
], | ||
"payloadData": [ | ||
{ | ||
"name": "triggered_time", | ||
"type": "LONG" | ||
}, | ||
{ | ||
"name": "humidity", | ||
"type": "FLOAT" | ||
}, | ||
{ | ||
"name": "sensorValue", | ||
"type": "DOUBLE" | ||
} | ||
] | ||
} |
44 changes: 44 additions & 0 deletions
44
modules/samples/artifacts/0119/eventstreams/org.wso2.event.sensor.stream_1.0.0.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "org.wso2.event.sensor.stream", | ||
"version": "1.0.0", | ||
"nickName": "", | ||
"description": "", | ||
"metaData": [ | ||
{ | ||
"name": "timestamp", | ||
"type": "LONG" | ||
}, | ||
{ | ||
"name": "isPowerSaverEnabled", | ||
"type": "BOOL" | ||
}, | ||
{ | ||
"name": "sensorId", | ||
"type": "INT" | ||
}, | ||
{ | ||
"name": "sensorName", | ||
"type": "STRING" | ||
} | ||
], | ||
"correlationData": [ | ||
{ | ||
"name": "longitude", | ||
"type": "DOUBLE" | ||
}, | ||
{ | ||
"name": "latitude", | ||
"type": "DOUBLE" | ||
} | ||
], | ||
"payloadData": [ | ||
{ | ||
"name": "humidity", | ||
"type": "FLOAT" | ||
}, | ||
{ | ||
"name": "sensorValue", | ||
"type": "DOUBLE" | ||
} | ||
] | ||
} |
48 changes: 48 additions & 0 deletions
48
modules/samples/artifacts/0119/eventstreams/periodicalTriggeredSensorStream_1.0.0.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "periodicalTriggeredSensorStream", | ||
"version": "1.0.0", | ||
"nickName": "", | ||
"description": "", | ||
"metaData": [ | ||
{ | ||
"name": "timestamp", | ||
"type": "LONG" | ||
}, | ||
{ | ||
"name": "isPowerSaverEnabled", | ||
"type": "BOOL" | ||
}, | ||
{ | ||
"name": "sensorId", | ||
"type": "INT" | ||
}, | ||
{ | ||
"name": "sensorName", | ||
"type": "STRING" | ||
} | ||
], | ||
"correlationData": [ | ||
{ | ||
"name": "longitude", | ||
"type": "DOUBLE" | ||
}, | ||
{ | ||
"name": "latitude", | ||
"type": "DOUBLE" | ||
} | ||
], | ||
"payloadData": [ | ||
{ | ||
"name": "triggered_time", | ||
"type": "LONG" | ||
}, | ||
{ | ||
"name": "humidity", | ||
"type": "FLOAT" | ||
}, | ||
{ | ||
"name": "sensorValue", | ||
"type": "DOUBLE" | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
modules/samples/artifacts/0119/executionplans/ExecutionPlan.siddhiql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* Enter a unique ExecutionPlan */ | ||
@Plan:name('ExecutionPlan') | ||
|
||
/* Enter a unique description for ExecutionPlan */ | ||
-- @Plan:description('ExecutionPlan') | ||
|
||
/* define streams/tables and write queries here ... */ | ||
|
||
|
||
@Import('org.wso2.event.sensor.stream:1.0.0') | ||
define stream sensorStream (meta_timestamp long, meta_isPowerSaverEnabled bool, meta_sensorId int, meta_sensorName string, correlation_longitude double, correlation_latitude double, humidity float, sensorValue double); | ||
|
||
|
||
@Export('cronTriggeredSensorStream:1.0.0') | ||
define stream cronTriggeredSensorStream (meta_timestamp long, meta_isPowerSaverEnabled bool, meta_sensorId int, meta_sensorName string, correlation_longitude double, correlation_latitude double, triggered_time long, humidity float, sensorValue double); | ||
|
||
@Export('periodicalTriggeredSensorStream:1.0.0') | ||
define stream periodicalTriggeredSensorStream (meta_timestamp long, meta_isPowerSaverEnabled bool, meta_sensorId int, meta_sensorName string, correlation_longitude double, correlation_latitude double, triggered_time long, humidity float, sensorValue double); | ||
|
||
define trigger periodicalTriggerStream at every 5 sec ; | ||
|
||
define trigger cronTriggerStream at '*/10 * * * * ?' ; | ||
|
||
from periodicalTriggerStream join sensorStream#window.time(10 sec) | ||
select meta_timestamp, meta_isPowerSaverEnabled, meta_sensorId, meta_sensorName, correlation_longitude, correlation_latitude, triggered_time, humidity, sensorValue | ||
insert into periodicalTriggeredSensorStream; | ||
|
||
from cronTriggerStream join sensorStream#window.time(10 sec) | ||
select meta_timestamp, meta_isPowerSaverEnabled, meta_sensorId, meta_sensorName, correlation_longitude, correlation_latitude, triggered_time, humidity, sensorValue | ||
insert into cronTriggeredSensorStream; |