0

I'm newbie to the Drools. Here i'm trying to generate a notification if a process is running for longer than some time - let's say 5 minutes.

To achieve the above I'm writing the following code in DRL file. But it doesn't seem to be working.

drl file

declare Message
  @role(event) 
end 

rule "RULE 3" 
 when
   $message: Message(msgtext == "1st message") over window:time( 5m ) from entry-point entryone
 then
    System.out.println("RULE 3 (after 5 min of message event started): " +     $message.getMsgtext());
 end

In the above .drl file I have an event named Message declared. The rule is checking whether msgtext is 1st message and it is running for 5 minutes - if that's the case, I have to generate a notification. In this example I'm just printing the result.

Thanks in advance. I appreciate your help.

andr
  • 15,970
  • 10
  • 45
  • 59

1 Answers1

0

Few things to check,

  • Put your entry point name in quotes
  • Does it work without the time constraint (i.e. only message: Message(msgtext == "1st message")
  • Note, this is checking to see if the message "1st message" has been added within the last 5 minutes
  • Make sure you're in stream mode

-hth

eze
  • 2,332
  • 3
  • 19
  • 30
  • Thank you so much for your response. I've passed this problem by using timer(int:5m) instead of window sliding. – user2128234 Mar 14 '13 at 14:28