是否有可能控制Siddhi Cep的时间

时间:2018-05-26 05:21:47

标签: java siddhi

在下面的例子中,时间是cpu时间。我正在努力的是当我运行时间序列进行反向测试时,数据会按顺序到达,但速度要快得多,基于定时窗口的后续逻辑将不正确 我的问题: - 对我来说,理想的解决方案是使用到达时间序列事件的时间戳来更改Siddi时间。这可能吗? - 如果没有,有什么建议来解决这个问题。

from fooStream#window.timeBatch(10 sec)
select count() as count
insert into barStream;

3 个答案:

答案 0 :(得分:0)

也许您可以使用Siddhi的externalTime窗口功能。

见文件 https://wso2.github.io/siddhi/api/latest/#externaltime-window

答案 1 :(得分:0)

您可以根据需要使用siddhi externalTimeWindow [1]。

对于extenrnalTimewindow,您可以提供自己的时间戳,窗口时间将根据您提供的时间戳计算。

[1] https://wso2.github.io/siddhi/api/latest/#externaltime-window

答案 2 :(得分:0)

You can use the externalTimeWindow[1] as previously mentioned. However, what you are looking for is playback [2].

In Siddhi, internally there are two TimestampGenerators. Namely EventTimeBasedMillisTimestampGenerator and SystemCurrentTimeMillisTimestampGenerator. By default SystemCurrentTimeMillisTimestampGenerator will be used with the Siddhi CEP engine. But, if you use playback annotation, it'll change to EventTimeBasedMillisTimestampGenerator. If you use this, Siddhi will use the timestamp of arriving time series event as the CEP engines time.

[1] https://wso2.github.io/siddhi/api/latest/#externaltime-window

[2] https://wso2.github.io/siddhi/documentation/siddhi-4.0/#appplayback

[3] https://github.com/wso2/siddhi/blob/master/modules/siddhi-core/src/test/java/org/wso2/siddhi/core/managment/PlaybackTestCase.java