[rules-users] Rules with variable timers

Wolfgang Laun wolfgang.laun at gmail.com
Tue Dec 18 10:41:43 EST 2012


If you let users write (part of) the rules, a simple solution would be
to let them define the values in a rule like

declare UserParameter
   para : ...
   parb : ...
...
end

rule "init user parameters"
salience 1000
when
then
    insert( new UserParameter( ..., ... ) ) // user defines para, parab,...
end

and then you can write rules using UserParameter().

You might write (high priority) rules for checking the supplied values
- which you can't if they'd provide the values for a timer. Or you can
create other parameter facts containing values derived from those in
UserParameter.

-W



On 18/12/2012, riri <irina.adam at gmail.com> wrote:
> Hy,
>
> I would also be interested in having a timer working with variables. In my
> case I need to have a rule that fires when an event is detected inside a
> certain interval of time (say 22h-07h in a day), and this interval should
> be
> configurable at runtime. I tried using a global value but I get an "Unable
> to build set timer" error.
>
> Another way to do this I guess would be to put a timestamp attribute in my
> event class and check if the value is inside the interval but I was looking
> forward to using the functionality of the cron timer.. Would it be possible
> to use domain specific language parameters {} in the timer? It would really
> be helpful to be able to use some sort of variable since the whole idea
> behind my application is to allow the users to set values in the rules
> without having to directly modify the .drl file.
>
> If there are better ideas out there I'm open to suggestions since I'm just
> starting with Drools and Fusion.
>
> Regards
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Rules-with-variable-timers-tp3262197p4021237.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