[rules-users] A question about use sliding window with and without entry point

Yu Changyuan reivzy at gmail.com
Fri Oct 4 09:33:56 EDT 2013


Confirmed, the problem not happen with 5.6.0-SNAPSHOT(see
https://github.com/yuchangyuan/drools-test1s/tree/drools-5.6.0-SNAPSHOT).

So, the bug is fixed and I am a little curious which commit fix the problem.



On Fri, Oct 4, 2013 at 9:19 PM, Yu Changyuan <reivzy at gmail.com> wrote:

> Thank you for your response.
>
> I write my code in scala(that's why I don't include code in first post),
> and use sbt as build tool. I upload the code to github, at
>  https://github.com/yuchangyuan/drools-test1s , so just clone the repo to
> get the code.
>
> sbt 0.13 should be installed(see http://www.scala-sbt.org/ for howto
> install) before the code can be built and run,
> after install sbt, just type 'sbt run' in project root directory(the
> directory contain 'build.sbt' file) to compile and run the code.
>
> For drools 5.6.0-SNAPSHOT, I will try later.
>
>
>
>
> On Fri, Oct 4, 2013 at 6:56 PM, Davide Sottara <dsotty at gmail.com> wrote:
>
>>  No, this is not normal.
>> I could not reproduce it in 5.6.0-SNAPSHOT, however, could you try that
>> version too, and/or post a full
>> reproducer - i.e. the exact code you are running?
>> Hopefully it is already fixed
>> Thanks
>>
>>
>>
>> On 10/03/2013 11:11 PM, Yu Changyuan wrote:
>>
>> Hi, everyone,
>>
>>   I just find that, insert an event into a entry point or insert it
>> directly into session will cause different behaviour, is this expected?
>>
>>   Here is the details:
>>
>> 1. drools run in stream mode and use pseudo clock
>> 2. insert a MyEvent into entry-point "stream" and a MyEvent into session
>> directly every 1 seconds, start at 500ms.
>> 3. call fireAllRules every 1seconds, at second 1, second 2, etc
>> 4. drools version 5.5.0.Final
>>
>> Below is the rule:
>>
>> package me.ycy.drools.test1.data
>>
>> import java.util.List
>>
>> declare MyEvent
>>     @role(event)
>>     @timestamp(timestamp)
>> end
>>
>> rule "over 0.3s"
>>     when
>>         $list: List() from collect(MyEvent() over window:time(300ms))
>>     then
>>         System.out.println("Rule: with in 0.3s --> " + $list);
>> end
>>
>> rule "over 1s"
>>     when
>>         $list: List() from collect(MyEvent() over window:time(1s))
>>     then
>>         System.out.println("Rule: with in 1s --> " + $list);
>> end
>>
>> rule "over 3s"
>>     when
>>         $list: List() from collect(MyEvent() over window:time(3s))
>>     then
>>         System.out.println("Rule: with in 3s --> " + $list);
>> end
>>
>> rule "over 0.3s ep"
>>     when
>>         $list: List() from collect(MyEvent() over window:time(300ms) from
>> entry-point "stream")
>>     then
>>         System.out.println("Rule: with in 0.3s use ep --> " + $list);
>> end
>>
>> rule "over 1s ep"
>>     when
>>         $list: List() from collect(MyEvent() over window:time(1s) from
>> entry-point "stream")
>>     then
>>         System.out.println("Rule: with in 1s use ep --> " + $list);
>> end
>>
>> rule "over 3s ep"
>>     when
>>         $list: List() from collect(MyEvent() over window:time(3s) from
>> entry-point "stream")
>>     then
>>         System.out.println("Rule: with in 3s use ep --> " + $list);
>> end
>>
>> // ------- end of rule
>>
>> Finally, the output(just run 5 seconds)
>>
>> -------------- fire at 1000 ---------------
>> Rule: with in 3s use ep --> [MyEvent(event 0,500)]
>> Rule: with in 1s use ep --> [MyEvent(event 0,500)]
>> Rule: with in 0.3s use ep --> [MyEvent(event 0,500)]
>> Rule: with in 3s --> [MyEvent(event 0,500)]
>> Rule: with in 1s --> [MyEvent(event 0,500)]
>> Rule: with in 0.3s --> []
>> -------------- fire at 2000 ---------------
>> Rule: with in 3s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500)]
>> Rule: with in 1s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500)]
>> Rule: with in 0.3s use ep --> [MyEvent(event 0,500), MyEvent(event
>> 1,1500)]
>> Rule: with in 3s --> [MyEvent(event 0,500), MyEvent(event 1,1500)]
>> Rule: with in 1s --> [MyEvent(event 1,1500)]
>> Rule: with in 0.3s --> []
>> -------------- fire at 3000 ---------------
>> Rule: with in 3s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500),
>> MyEvent(event 2,2500)]
>> Rule: with in 1s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500),
>> MyEvent(event 2,2500)]
>> Rule: with in 0.3s use ep --> [MyEvent(event 0,500), MyEvent(event
>> 1,1500), MyEvent(event 2,2500)]
>> Rule: with in 3s --> [MyEvent(event 0,500), MyEvent(event 1,1500),
>> MyEvent(event 2,2500)]
>> Rule: with in 1s --> [MyEvent(event 2,2500)]
>> Rule: with in 0.3s --> []
>> -------------- fire at 4000 ---------------
>> Rule: with in 3s use ep --> [MyEvent(event 1,1500), MyEvent(event
>> 2,2500), MyEvent(event 3,3500)]
>> Rule: with in 1s use ep --> [MyEvent(event 1,1500), MyEvent(event
>> 2,2500), MyEvent(event 3,3500)]
>> Rule: with in 0.3s use ep --> [MyEvent(event 1,1500), MyEvent(event
>> 2,2500), MyEvent(event 3,3500)]
>> Rule: with in 3s --> [MyEvent(event 1,1500), MyEvent(event 2,2500),
>> MyEvent(event 3,3500)]
>> Rule: with in 1s --> [MyEvent(event 3,3500)]
>> Rule: with in 0.3s --> []
>> -------------- fire at 5000 ---------------
>> Rule: with in 3s use ep --> [MyEvent(event 2,2500), MyEvent(event
>> 3,3500), MyEvent(event 4,4500)]
>> Rule: with in 1s use ep --> [MyEvent(event 2,2500), MyEvent(event
>> 3,3500), MyEvent(event 4,4500)]
>> Rule: with in 0.3s use ep --> [MyEvent(event 2,2500), MyEvent(event
>> 3,3500), MyEvent(event 4,4500)]
>> Rule: with in 3s --> [MyEvent(event 2,2500), MyEvent(event 3,3500),
>> MyEvent(event 4,4500)]
>> Rule: with in 1s --> [MyEvent(event 4,4500)]
>> Rule: with in 0.3s --> []
>>
>>
>>
>> --
>> Best regards,
>> Changyuan
>>
>>
>> _______________________________________________
>> rules-users mailing listrules-users at lists.jboss.orghttps://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
>>
>
>
>
> --
> Best regards,
> Changyuan
>



-- 
Best regards,
Changyuan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20131004/8b8d3854/attachment.html 


More information about the rules-users mailing list