Skip to content

Instantly share code, notes, and snippets.

@DuncanDoyle
Created November 18, 2015 13:44
Show Gist options
  • Save DuncanDoyle/c82063ff3b2d5042252a to your computer and use it in GitHub Desktop.
Save DuncanDoyle/c82063ff3b2d5042252a to your computer and use it in GitHub Desktop.
package org.jboss.ddoyle.drools.rules
import org.jboss.ddoyle.drools.model.SimpleEvent
declare SimpleEvent
@role( event )
@timestamp( timestamp )
@expires( 120s )
end
rule "rule_1"
when
$s: SimpleEvent ()
not SimpleEvent (this != $s, this after[0, 30s] $s)
then
System.out.println("No event within 30 seconds of this event: " + $s.getId());
end
rule "rule_2"
when
$s: SimpleEvent ()
not SimpleEvent (this != $s, timestamp after[0, 30s] $s.timestamp)
then
System.out.println("With timestamp in temporal operators: No event within 30 seconds of this event: " + $s.getId());
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment