Skip to content

Instantly share code, notes, and snippets.

@DuncanDoyle
Created November 17, 2015 15:20
Show Gist options
  • Save DuncanDoyle/7bb7f2fbfb87eaedccb8 to your computer and use it in GitHub Desktop.
Save DuncanDoyle/7bb7f2fbfb87eaedccb8 to your computer and use it in GitHub Desktop.
package org.jboss.ddoyle.drools.rules
import org.jboss.ddoyle.drools.model.SimpleEvent
import org.jboss.ddoyle.drools.model.NoExpirationSimpleEvent
declare SimpleEvent
@role( event )
@timestamp( timestamp )
@expires( 10s )
end
declare NoExpirationSimpleEvent
@role (event)
@timestamp ( timestamp )
@expires ( 100d )
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment