[rules-users] Strange exit in RuleFlow

Femke De Backere femmyke at gmail.com
Sun Mar 8 13:12:41 EDT 2009


Thx for the explanation.

I added the code to my application, but my timer still doesn't seem to  
work, but now my app doesn't crash anymore.

Femke

Op 8-mrt-09, om 03:51 heeft Kris Verlaenen het volgende geschreven:

> Femke,
>
> The reason is that the Drools engine by default is a passive  
> component,
> meaning that it will only execute if you tell it to explicitly (e.g.
> using fireAllRules()).  In this case, if you use a small timer the
> engine is still executing startProcess() and hence the timer will be
> executed.  When using a larger timer delay, the timer will trigger but
> will only put an action on the action queue.  If you would call
> fireAllRules after one minute, all queued actions (in this case the
> execution of the timer) will be executed.  You can however also
> configure the Drools engine to fire continuously using  
> fireUntilHalt().
> I just added this new section in the documentation to explain it:
>
> By default, the Drools engine is a passive component, meaning that it
> will only start processing if you tell it to (for example, you first
> insert the necessary data and then tell the engine to start  
> processing).
> In passive mode, a timer that has been triggered will be put on the
> action queue. This means that it will be executed the next time the
> engine is told to start executing by the user (using fireAllRules() or
> if the engine is already / still running), in which case the timer  
> will
> be executed automatically.
>
> When using timers, it does usually make sense to make the Drools  
> engine
> an active component, meaning that it will execute actions whenever  
> they
> become available (and not wait until the user tells it to start
> executing again). This would mean a timer would be executed once it is
> triggered. To make the engine fire all actions continuously, you must
> call the fireUntilHalt() method. That means the engine will continue
> firing until the engine is halted. The following fragment shows how to
> do this (note that you should call fireUntilHalt() in a separate  
> thread
> as it will only return if the engine has been halted (by either the  
> user
> or some logic calling halt() on the session):
>
> new Thread(new Runnable() {
>  public void run() {
>    ksession.fireUntilHalt();
>  }
> }).start();
>
> // starting a new process instance
> ksession.startProcess("...");
> // any timer that will trigger will now be executed automatically
>
> Kris
>
> Quoting Femke De Backere <femmyke at gmail.com>:
>
>> Hi!
>>
>> I have a really strange problem with my ruleflow. I have a ruleflow
>>
>> process with some workhandlers. The flow seems to work perfectly,
>> until I arrive at the timer. The timer itself executes well, if it
>> delays for a period of only 4 milliseconds. The flow stops running on
>>
>> the join component (because I don't reach the workhandler CheckRass,
>>
>> in the debugging).
>>
>>  If I give the timer a delay period of 1 minute (60 000
>> milliseconds), the flow stops running at the timer component. The
>> action nodes before and after the timer contain print statements and
>>
>> in this case I never reach the printstatement after the timer.
>>
>> I really don't understand why my flow stops running at these points,
>>
>> as I never reach an end node. Does anyone see the problem? (I added a
>>
>> printscreen of my ruleflow)
>>
>> Thx!
>>
>> Femke
>>
>> If I
>
>
>
> _______________________________________________
> 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