运行 Siddhi 中触发的时间

Run Time of the Trigger in Siddhi

我想阅读来自 siddhi 的 postgres table,我正在使用触发器:

@From(eventtable='rdbms', jdbc.url='jdbc:postgresql://localhost:5432/pruebabg', username='postgres', password='Easysoft16', driver.name='org.postgresql.Driver', table.name='Trazablack')
define table Trazablack (sensorValue double);

define trigger FiveMinTriggerStream at every 10 min;

from FiveMinTriggerStream join Trazablack as t
select t.sensorValue as sensorValue
insert into StreamBlack;

但是,我有一个问题,查询是每 10 分钟 运行,我需要在新事件到达时 运行。

这可能吗?

from sensorStream#window.length(2) 
JOIN StreamBlack#window.length(1)
   on sensorStream.sensorValue==StreamBlack.sensorValue
select sensorStream.meta_timestamp, sensorStream.meta_sensorName, sensorStream.correlation_longitude, 
       sensorStream.correlation_latitude, sensorStream.sensorValue as valor1, StreamBlack.sensorValue as valor2
insert INTO StreamPaso;


from sensorStream#window.length(2) 
LEFT OUTER JOIN StreamBlack#window.length(1)
   on sensorStream.sensorValue==StreamBlack.sensorValue
select sensorStream.meta_timestamp, sensorStream.meta_sensorName, sensorStream.correlation_longitude, 
       sensorStream.correlation_latitude, sensorStream.sensorValue as valor1, StreamBlack.sensorValue as valor2
insert INTO StreamPaso;

在这种情况下,您可以简单地使用输入流进行连接,而不是使用 window 触发流。我们可以使用 0 长度 window,因为我们不需要在 window 中存储任何内容,并且我们需要在事件通过流到达时触发查询。我们还可以使用 'current events'(即传入事件)子句来确保不考虑 window 的 'expired events'(即由 window 保留和发出的事件) (参考 Siddhi QL documentation on windows 了解更多信息)。

例如(假设 sensorStream 是输入流):

from sensorStream#window.length(0) join Trazablack as t
select t.sensorValue as sensorValue
insert current events into StreamBlack;