[rules-users] Odd behavior on timeInMillis after[15m, 96h] otherTimeInMillis

ScalaEnthusiast carvel.baus at gmail.com
Thu May 9 16:13:46 EDT 2013


I am attempting to use the after[start, end] construct with two time values
being returned in milliseconds.

We are effectively using Drools 5.3 (BRMS 5.3.1). 

Here is what I have (field names changed, etc due to nature of data):

//---------------------------------------------

global String someInsertedConstant;
global Calendar myCurrentTime;        // calculated just before inserting as
global.


rule "compare time in millis"
    dialect "java"
    when
         $someObject : SomeObjectClass ( field1 == someInsertedConstant,
                                                        field2 == null,
                                                       
myCurrentTime.timeInMillis after[15m, 96h]
someObject.getTime().getTimeInMillis ) from entry-point "SomeEntryPoint"
     then
          System.out.println("Boo-yah!!!");

//-------------------------

This does not send out a Boo-yah!!! as I would expect, when myCurrentime is
15 minutes or more past someObject.getTime(). However, I have another rule
just like this, where the only difference is the after is [0m,15m] instead,
and it gives a Boo-yah!!! as it should when myCurrentTime is up to 15
minutes past someObject.getTime(). Both rules are together in the same
package.

Am I missing something here? In the first case, "after[15m, 96h]", I can
change that line to manually subtract the two times as longs and compare
against being >= 900000 and it fires as it should. This appears to be a bug,
but I am not entirely sure as I am fairly new to the rule world.

What am I missing?

Thanks,

ScalaEnthusiast







--
View this message in context: http://drools.46999.n3.nabble.com/Odd-behavior-on-timeInMillis-after-15m-96h-otherTimeInMillis-tp4023763.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list