My DRL file:
package com.sample.eventmanagement;
import com.sample.eventmanagement.CheckInEvent
import com.sample.eventmanagement.LateCheckInEvent
global java.util.concurrent.BlockingQueue lateCheckInEntitiesQueue;
global java.util.concurrent.BlockingQueue clearingLateCheckInEntitiesQueue;
declare CheckInEvent
@role(event)
serialNum : String
currentCheckInTime : long
end
declare LateCheckInEvent
@role(event)
@expires( 120m )
serialNum : String
currentCheckInTime : long
end
rule "Raising an Late Check-In Alert"
when
$s1: CheckInEvent( $serialNum : serialNum, $currentCheckInTime: currentCheckInTime ) from entry-point apCheckInStream
not( CheckInEvent( serialNum == $serialNum, currentCheckInTime > $currentCheckInTime, this after[ 1s, 360s ] $s1 ) from entry-point apCheckInStream)
then
lateCheckInEntitiesQueue.add($s1);
end
rule "Clearing Late Check-In Alert"
when
$s1: LateCheckInEvent( $serialNum : serialNum, $currentCheckInTime: currentCheckInTime ) from entry-point lateApCheckInStream
CheckInEvent( serialNum == $serialNum, currentCheckInTime > $currentCheckInTime) from entry-point clearingApCheckInStream
then
System.out.println("Clearing late checkin " + $s1);
clearingLateCheckInEntitiesQueue.add($s1.getSerialNum());
end
I am running drools in stream mode in karaf 2.4.3 in linux vm, reports out of memory for 10k entity checkinevent pumping every 5 minutes.
My use case is detect latecheckinevent for entity identified by serialnumber. On late checkin event detected pumping that event to another rule and waiting for proper checkin again from that entity within 2 hours. If it happens rule 2 is fired.
Is there any problem in the way i have the written the query. ?