[rules-users] setting the @expires in java

Davide Sottara dsotty at gmail.com
Fri Aug 16 07:32:33 EDT 2013


Drools should have expr-based timers to help with this:

rule "Retract Dynamic"
timer( expr : $x )            // retract after $x
when
    $f : Fact( $x : expireTime )
then
    retract( $f );
end

The reason why you can't use variables in @expires
is that the engine runs an optimization algorithm at startup,
to optimize and pre-schedule expirations. It would be impossible
to run it if you had variable expiration.

Best
Davide

On 08/16/2013 08:30 AM, Wolfgang Laun wrote:
> On 16/08/2013, samsonrithvik <samsonrithvik.cts at gmail.com> wrote:
>> ok
>> so how do i set the expires value which changes dynamically according to my
>> requirement ?
> If you can't, then you don't.
>
> What you'll have to do is to program the retraction according to the
> dynamic value. Not trivial, because Drools timers don't have dynamic
> timers.
>
> -W
>
>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/setting-the-expires-in-java-tp4025574p4025576.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
>>
> _______________________________________________
> 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