我正在使用Drools制作一个CEP。我有两类事件-- ExpectedEvent和ActualEvent。我需要确保ActualEvent对象发生在ExpectedEvent对象之前。然而,我无法让前面的关键词起作用。这是流模式。
import hellodrools.ExpectedEvent
import hellodrools.ActualEvent
dialect "java"
rule "On Time"
when
ExpectedEvent($expectedtime : getStart_time()) from entry-point entry one
$actual:ActualEvent( this after[ 1m ] $expected ) from entry-point entryone
then
System.out.println("ON TIME expected time: " + $expectedtime + " actual time " + $actualtime);
end在IntelliJ中,我经常在$actual上看到错误,说“$actual”是意外的。我无法解决这个语法错误。
发布于 2017-03-31 19:26:35
我认为这与IntelliJ无关,尽管这里的IntelliJ似乎没有报告正确的错误。
我认为这里的实际问题是,from entry-point需要一个字符串文本或一个有效的标识符,它将用于入口点ID (即字符串)。
在您的规则中,"entry one“不是有效的标识符,因为它包含一个空格,也不是字符串文字,因为它没有用双引号(")括起来。
您可以尝试替换from entry-point entry one
用from entry-point "entry one"
https://stackoverflow.com/questions/41767981
复制相似问题