[rules-users] using Drools global variables inside operator timer(int: <variable name> s)

skatta1986 shivaprasad_gdk at yahoo.co.in
Mon Apr 30 10:14:39 EDT 2012


Hi,

I want a global variable inside a timer instead of hard coding.

------------------------------------------------- 

ksession.setGlobal( "timeout", new Integer(10)); 

---------------------------------------

*
Improper (not working) rule: *

global Integer timeout; 

rule "tmeout case" 
timer( int: timeout.intValue() s ) 
    when 
         $request : EventRecord(eventType == "EVENT_REGISTER", user ==
"katta") from entry-point "AggStream" 
        and not (EventRecord( eventType == "EVENT_RESPONSE", ", user ==
"katta", this after[ 0s, 10s ] $request ) from entry-point "AggStream") 

     then 
          System.out.println("-- timeout for user : "+ $request.getUser() ); 
end 
------------------------------------------------------ 

This new rule doesn't give any error but it is giving unexpected result. 

For example if a fire only one EventRecord(eventType == "EVENT_REGISTER",
user == "katta") into the working memory, then after 10seconds I should get
timeout as per my requirement. 

But for the above rule as soon as I fire the EventRecord it is giving as
timeout. 


Please help me in this regard 


--
View this message in context: http://drools.46999.n3.nabble.com/using-Drools-global-variables-inside-operator-timer-int-variable-name-s-tp3950828.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list