1
我正在嘗試爲某個事件編寫一個規則,該事件需要檢查某些事件是否發生在某個時間窗口之後。目前的代碼如下所示(它工作正常):如何在drools-fusion中編寫動態臨時規則
rule "Detect BPM reseed not starting when requested from Mart"
when
$martDailyRefreshRequestedEvent: MessageSentEvent(
$correlationId: correlationId,
$when: timestamp,
messageTypeName == "MartDailyRefreshCompletedEvent")
from entry-point "mart"
not (MessageHandleStartedEvent(
this after[0ms, 30s] $martDailyRefreshRequestedEvent,
correlationId == $correlationId,
messageTypeName == "MartDailyRefreshCompletedEvent")
from entry-point "bpm")
then
notifier.notify("BPM not responding to MartDailyRefreshCompletedEvent quick enough",
String.format(
"At **%s** Mart sent out a **MartDailyRefreshCompletedEvent**.\n\n**BPM** was supposed to react to it within **30 seconds**.",
$when));
end
此刻的30s
實際上是硬編碼。我讀到,如果你想參數化規則,你需要使用其他事實來聲明KB,但我無法弄清楚如何處理時態規則。
所以:如何在該規則中配置30s
以便我可以更改應用程序外部的值?像這樣:MessageHandleStartedEvent(this after [ $duration ] ...