在drools fusion中是否有一种方法可以匹配最早的事件?
我有一个事件流,我们称之为在drools fusion中是否有一种方法可以匹配最早的事件?,drools,drools-fusion,Drools,Drools Fusion,我有一个事件流,我们称之为Foo,它们是按时间顺序插入的,还有另一个事件流Bar,它们也是按时间顺序插入的 我有一个规则,它将Bars与Foos进行模糊匹配,我想做的是将最古老的Bar与最古老的Foo进行匹配,是否有办法确保规则按照事件的时间顺序触发-有点像显著性,但时间 Foos的速度比Bars快,而且不是每个Foo都会有一个Bar我不确定你想要实现什么,但是如果你想将最旧的Foo与最旧的Bar匹配,你可以尝试这样的方法: rule "Oldest Far with oldest Bar" w
Foo
,它们是按时间顺序插入的,还有另一个事件流Bar
,它们也是按时间顺序插入的
我有一个规则,它将Bar
s与Foo
s进行模糊匹配,我想做的是将最古老的Bar
与最古老的Foo
进行匹配,是否有办法确保规则按照事件的时间顺序触发-有点像显著性
,但时间
Foo
s的速度比Bar
s快,而且不是每个Foo
都会有一个Bar我不确定你想要实现什么,但是如果你想将最旧的Foo
与最旧的Bar
匹配,你可以尝试这样的方法:
rule "Oldest Far with oldest Bar"
when
$oldestF: Foo()
not Foo( this before $oldestF )
$oldestB: Bar(//in here you can correlate this Bar with the $oldestF)
not Bar( this before $oldestBar)
then
//do something
end
如果您希望按顺序处理这些匹配,那么您可能希望在事实中使用一个标志,以便在继续循环处理后可以丢弃这些匹配:
rule "Oldest Far with oldest Bar"
when
$oldestF: Foo( processed == false )
not Foo( this before $oldestF )
$oldestB: Bar( processed == false //in here you can correlate this Bar with the $oldestF)
not Bar( this before $oldestBar)
then
//do something
modify($oldestF){ setProcessed(true) };
modify($oldestB){ setProcessed(true) };
end
希望能有所帮助,Ahh-thenot Foo(这是$oldestF之前的版本)
这是我错过的技巧!