WSO2CEP SiddhiQL - 如何将属性从一个流插入到另一个流
WSO2CEP SiddhiQL - how to insert the attributes from one stream to another stream
我正在使用 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 的属性。我已经尝试了上面的方法,但是因为错误而不起作用:
"You have an error in your SiddhiQL at line 39:23, extraneous input
'(' expecting {, ';'}"
错误出现在执行计划最后一行的 alertStream 和括号之间。
我不知道我做错了什么。如果有人能帮助我解决这个问题,我将不胜感激。
谢谢!
请在下面找到 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”。
您可以参考 more Siddhi samples here on WSO2 CEP documentation page. This Siddhi QL guide 提供有关 Siddhi 语言的完整参考。
我正在使用 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 的属性。我已经尝试了上面的方法,但是因为错误而不起作用:
"You have an error in your SiddhiQL at line 39:23, extraneous input '(' expecting {, ';'}"
错误出现在执行计划最后一行的 alertStream 和括号之间。
我不知道我做错了什么。如果有人能帮助我解决这个问题,我将不胜感激。
谢谢!
请在下面找到 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”。
您可以参考 more Siddhi samples here on WSO2 CEP documentation page. This Siddhi QL guide 提供有关 Siddhi 语言的完整参考。