在WSO2 CEP 4.0.0的执行计划中定义表的异常

时间:2015-10-08 14:18:58

标签: wso2 wso2cep siddhi

我正在尝试从WSO2 CEP 3.1.0迁移到WSO2 CEP 4.0.0。

我已将现有的执行计划转换为新的SiddhiQL语法:

@Plan:name('occurredFailure')

@Import('responseTimeStream:1.0.0')
define stream responseTimeStream (service string, responseTime int);

@Import('queryTimeStream:1.0.0')
define stream queryTimeStream (service string, queryTime int);

@Export('occurredFailureStream:1.0.0')
define stream occurredFailureStream (service string, cause string);

define table slowestQueryTimeTable (service string, slowestQueryTime int);

from responseTimeStream[responseTime == 0]
select service, 'noResponse' as cause
insert into occurredFailureStream;

from queryTimeStream[queryTime >= 5000]
select service, 'queryTimeout' as cause
insert into occurredFailureStream;

from queryTimeStream[not((service == slowestQueryTimeTable.service) in slowestQueryTimeTable)]
select service, queryTime as slowestQueryTime
insert into slowestQueryTimeTable;

from queryTimeStream[(service == slowestQueryTimeTable.service and queryTime <= slowestQueryTimeTable.slowestQueryTime) in slowestQueryTimeTable]
select service, queryTime as slowestQueryTime
update slowestQueryTimeTable
on queryTimeStream.service == slowestQueryTimeTable.service;

from responseTimeStream[(service == slowestQueryTimeTable.service and responseTime >= slowestQueryTimeTable.slowestQueryTime) in slowestQueryTimeTable]
select service, 'responseTimeAboveQueryTime' as cause
insert into occurredFailureStream;

不幸的是,当我尝试验证查询表达式时,WSO2 CEP 4.0.0会抛出以下异常:

  

无法为表&#39; slowestQueryTimeTable&#39;创建更新,使用引用流:在执行计划中找不到queryTimeStream&#34; happenFailure&#34;

错误消息并不真正有用,因为如果我删除表格&quot; slowestQueryTimeTable&#39;和任何与之相关的表达式,其余的查询表达式都被成功验证,这意味着流&#39; queryTimeStream&#39;确实找到了。

你能帮我调试一下这个例外吗?

1 个答案:

答案 0 :(得分:1)

此问题出在查询

from queryTimeStream[(service == slowestQueryTimeTable.service and queryTime <= slowestQueryTimeTable.slowestQueryTime) in slowestQueryTimeTable]
select service, queryTime as slowestQueryTime
update slowestQueryTimeTable
 on queryTimeStream.service == slowestQueryTimeTable.service;

您不应在更新条件中使用queryTimeStream,因为输出数据不是来自queryTimeStream。更新查询如下

from queryTimeStream[(service == slowestQueryTimeTable.service and queryTime <= slowestQueryTimeTable.slowestQueryTime) in slowestQueryTimeTable]
select service, queryTime as slowestQueryTime
update slowestQueryTimeTable
 on service == slowestQueryTimeTable.service;