我正在使用WSO2 CEP并创建了以下执行计划:
define stream sensor1Stream (timestamp string, id string, latitude double, longitude double, altitude double);
define stream sensor2Stream (timestamp string, id string, latitude double, longitude double, altitude double);
define stream alertStream (alert_id bool, alert_level string, accuracy_level string, s1_timestamp string, s1_id string, s1_latitude double, s1_longitude double, s1_altitude double, s2_timestamp string, s2_id string, s2_latitude double, s2_longitude double, s2_altitude double);
from sensor1Stream
select timestamp as s1_timestamp, id as s1_id, latitude as s1_latitude, longitude as s1_longitude, altitude as s1_altitude
insert into alertStream(s1_timestamp, s1_id, s1_latitude, s1_longitude, s1_altitude);
from sensor2Stream
select timestamp as s2_timestamp, id as s2_id, latitude as s2_latitude, longitude as s2_longitude, altitude as s2_altitude
insert into alertStream(s2_timestamp, s2_id, s2_latitude, s2_longitude, s2_altitude);
我想在alertStream中插入来自sensor1Stream和sensor2Stream的属性。我已尝试过上述方法,但因错误而无效:
"你的SiddhiQL在第39:23行有一个错误,无关的输入 '('期待{,&#39 ;;'}"
错误发生在alertStream和执行计划最后一行的括号之间。
我不知道我做错了什么。如果有人可以帮我解决这个问题,我将非常感激。
谢谢!
答案 0 :(得分:0)
请在下面找到Siddhi执行计划的示例:
@Plan:name('ExecutionPlan')
@Import('org.wso2.event.sensor.stream:1.0.0')
define stream sensor_stream (meta_timestamp long, meta_isPowerSaverEnabled bool, meta_sensorId int, meta_sensorName string, correlation_longitude double, correlation_latitude double, humidity float, sensorValue double);
@Export('org.wso2.sensor.value.projected.stream:1.0.0')
define stream sensor_value_projected_stream (meta_sensorId int, correlation_longitude double, correlation_latitude double, humidity float, value double);
from sensor_stream
select meta_sensorId, correlation_longitude, correlation_latitude, humidity, sensorValue as value
insert into sensor_value_projected_stream;
此示例取自Siddhi示例' Pass-Through/Projection Query in an Execution Plan'。
您可以在WSO2 CEP文档页面上查看more Siddhi samples here。 This Siddhi QL guide提供有关Siddhi语言的完整参考。