[rules-users] Drools variables

Wolfgang Laun wolfgang.laun at gmail.com
Tue Apr 24 14:16:46 EDT 2012


I suppose that it's a bug that this expression is accepted by the parser.

The simple object reference "timeout" is rightly rejected.

-W


On 24/04/2012, skatta1986 <shivaprasad_gdk at yahoo.co.in> wrote:
> what about the paramaters of timer( int: <initial delay> <repeat interval>?
> )
> ?
>
> timer(int : 10s) --> is working properly
> but timer(int : <global variable name> s ) --> not working
>
> -------------------------------------------------------------
> working Rule:
>
> rule "tmeout case"
> timer( int: 10s )
>     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
> -----------------------------------------------
>
> Now I want to replace value "10" given in the above rule with a global
> variable.
>
> -------------------------------------------------
>
> 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.
>
> But for the new 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/Drools-variables-tp3935404p3936009.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list