Demo drl File

Shown is the demo drl file generated when creating a new session resource in Event Analytics.

package com.lawson.eventhub.analytics.drools;
 
import com.lawson.eventhub.analytics.drools.model.Event;
import com.lawson.eventhub.analytics.drools.model.HubEvent;
import com.lawson.eventhub.analytics.drools.model.Session;
import com.lawson.eventhub.analytics.drools.model.Start;
import com.lawson.eventhub.analytics.drools.model.Stop;
import com.lawson.eventhub.analytics.drools.model.Time;
import com.lawson.eventhub.analytics.drools.model.Util;
import com.lawson.eventhub.EventOperation;
import com.lawson.eventhub.EventPriority;
 
rule "Subscriptions_Demo"
	@subscription1(M3:MITMAS:U)
	then
end
 
rule "MITMAS_20_Demo"
	no-loop
	when
		event: HubEvent(publisher == "M3", documentName == "MITMAS", operation == EventOperation.UPDATE,
  elementValues["STAT"] == "20")
	then
		event.postEvent("MITMAS_20");
end
 
rule "Start_Demo"
	when
		start : Start()
	then
		System.out.println("Demo: Session " + start.getSessionName() + " started: " + start.toString());
		System.out.println("Demo: Session info: " + Session.getString());
end
 
rule "Time_Demo"
	when
		time : Time()
//		time : Time(sessionName == "Test", year == 2010, month == 8, day == 24, weekNumber == 34, 
dayOfWeek == Calendar.TUESDAY, hour == 10, minute >= 55 )
	then
		System.out.println("Demo: Session " + time.getSessionName() + " got time: " + time.toString());
end
 
rule "Stop_Demo"
	when
		stop : Stop()
	then
		System.out.println("Demo: Session " + stop.getSessionName() + " stopped: " + stop.toString());
end