[rules-users] Drools Fusion 6.0.0.CR3

Mark Proctor mproctor at codehaus.org
Wed Sep 11 16:27:45 EDT 2013


Unless you are using fireUntilHalt there is now no longer any async reactivity.  As discussed before, we have a stronger separation now between passive and reactive mode.

If you want to see what's happening, there is now a new trace debug information. You'll need a logback file similar to this, change the "info" to "trace":
https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/resources/logback-test.xml

We have added an experimental feature that allows the user to provide explicit (rather than implicit) async reaction while in passive execution mode.  Notice how it requires the user to provide a thread for this.

It has one too many unwrap pings to access, so we'll get that changed. But users will still need to cast to an internal interface, to show it's experimental. @mario: please make this a simple cast, instead of unwrapping. The other option is we could add it to the main interface, with javadoc caveats that it's api/signature will change  - but i worry how many people will use the method, without reading the javadocs, and complain once we change it.

We will be looking to have more explicit and declarative control over async behaviour for 6.1

final BlockingQueue<TimedRuleExecution> queue = new LinkedBlockingQueue<TimedRuleExecution>();
((StatefulKnowledgeSessionImpl)ksession).session.setTimedExecutionsQueue(queue);

final AtomicBoolean run = new AtomicBoolean(true);

Thread t = new Thread(new Runnable() {
    public void run() {
        try {
            while (run.get()) {
                queue.take().evauateAndFireRule();
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
});
t.setDaemon(true);
t.start();



On 11 Sep 2013, at 14:16, "Weiss, Wolfgang" <Wolfgang.Weiss at joanneum.at> wrote:

> Hi all!
>  
> I tried out Drools 6.0.0.CR3 and I have some difficulties in detecting patterns with rules containing temporal parameters. I’m using following rule:
>  
> rule "detect turn shifts"
>         agenda-group "evaluation"
>         salience 100
>        
>     when
>         $aae : AudioActivityEvent(value >= 50) from entry-point "LowLevelES"
>         not(AudioActivityEvent(value < 50, userID == $aae.userID, this after[0, 300ms] $aae) from entry-point "LowLevelES")
>     then
>         logger.info("turn shift START, user ID: " + $aae.getUserID() + ", " + $aae.toString());
> // do something else ...
> end
>  
> When inserting events following happens:
> 12:43:05,914 [main           ] DEBUG ReteooRuleBase                 - Starting Engine in PHREAK mode
> 12:43:06,225 [main           ] INFO  SemanticLifter                 - incoming event: AudioActivityEvent [userID=1, value=100.0]
> 12:43:06,295 [main           ] INFO  SemanticLifter                 - incoming event: AudioActivityEvent [userID=1, value=0.0]
> 12:43:06,344 [main           ] INFO  SemanticLifter                 - incoming event: AudioActivityEvent [userID=1, value=100.0]
> 12:43:11,096 [main           ] INFO  SemanticLifter                 - incoming event: AudioActivityEvent [userID=1, value=0.0]
> 12:43:11,100 [main           ] INFO  SemanticLifter                 - turn shift START, user ID: 1, AudioActivityEvent [userID=1, value=100.0]
> ...
>  
> The “turn shift start” should be detected 300ms after the third incoming event (12:43:06,344) which is not the case here. This rule worked for me when using Drools 5.5.0 and 6.0.0.Beta2 but not with 6.0.0.CR3 - I did not try any other version.
> This is my code to insert events:
> streamEntryPoint = ksession.getEntryPoint("LowLevelES");
> ...
>  
> streamEntryPoint.insert(lowLevelEvent);
> ksession.getAgenda().getAgendaGroup("evaluation").setFocus();
> ksession.fireAllRules();
>  
> “AudioActivityEvent” is declared as an event with the @role attribute. I also tried to use the following option: “RuleEngineOption.RETEOO”, but with no difference.
>  
>  
> Best regards,
> Wolfgang
>  
>  
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130911/6c544f50/attachment.html 


More information about the rules-users mailing list