fireUntilHalt vs fireAllRules

841 views
Skip to first unread message

Manjunath S Paramesan

unread,
May 12, 2017, 1:58:43 AM5/12/17
to Drools Usage
Hi All,

I seems to be seeing differences in the way fireUntilHalt operates and and fireAllRules operate.

We are running a CEP session. All time base rules work as expected in a CEP session and execute after X seconds. 

With the fireAllRules, the time based rules don't seem to get triggered, unless the fireAllRules in invoked after X seconds. 


The reason I had used fireAllRules was because we were unable to seralize the KieSession when fireUntilHalt is called, please see https://issues.jboss.org/browse/DROOLS-1471

It there an way to tell when a session becomes idle while using fireUntilHalt? 

How can clustering be achieved with drools?

Thanks,
Manjunath

Mark Proctor

unread,
May 15, 2017, 8:55:19 PM5/15/17
to drools...@googlegroups.com
fireAllRules by default is passive, fireUntilHalt is active. Being passive, rules cannot fire unless you call fireAllRules, so any timers wait until that point. For those that need it we added some TimedRuleExecutionOption:

Mark

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage+unsubscribe@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/8f45f270-9c96-4237-a3ce-48726a4ad737%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manjunath S Paramesan

unread,
May 15, 2017, 9:38:33 PM5/15/17
to Drools Usage
Thanks for the input. 

As a work around, I ended by writing a thread to which invokes fireAllRules, this thread is paused when the session is being serialised.

Thanks,
Manjunath 


On Tuesday, 16 May 2017 10:55:19 UTC+10, Mark Proctor wrote:
fireAllRules by default is passive, fireUntilHalt is active. Being passive, rules cannot fire unless you call fireAllRules, so any timers wait until that point. For those that need it we added some TimedRuleExecutionOption:

Mark

On Fri, May 12, 2017 at 6:58 AM, Manjunath S Paramesan <connect....@gmail.com> wrote:
Hi All,

I seems to be seeing differences in the way fireUntilHalt operates and and fireAllRules operate.

We are running a CEP session. All time base rules work as expected in a CEP session and execute after X seconds. 

With the fireAllRules, the time based rules don't seem to get triggered, unless the fireAllRules in invoked after X seconds. 


The reason I had used fireAllRules was because we were unable to seralize the KieSession when fireUntilHalt is called, please see https://issues.jboss.org/browse/DROOLS-1471

It there an way to tell when a session becomes idle while using fireUntilHalt? 

How can clustering be achieved with drools?

Thanks,
Manjunath

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.

Srinivas ev

unread,
Apr 15, 2018, 9:11:33 AM4/15/18
to Drools Usage
Hi Manjunath,

Can you pls explain me about this workaround.

How the timer rules will get triggered if you passed the thread.

Manjunath S Paramesan

unread,
Apr 15, 2018, 8:04:12 PM4/15/18
to Drools Usage
Hi Srinivas,

As mentioned in the documentation http://docs.jboss.org/drools/release/7.3.0.Final/drools-docs/html_single/#_timers_and_calendars  you could create a session with TimedRuleExecutionOption.YES.


If you want to execute in this is a thread, you could create a Callable as the fireAllRules() method returns an integer value and you perform a future.get to ensure the  rules have fired. The timed rules will fire when when they need to in the background.  

Hope this helps. 

Srinivas ev

unread,
Apr 17, 2018, 12:46:57 AM4/17/18
to Drools Usage
Hi Manjunath, do you mean fireAllRules() and fireUntilHalt() are same when TimedRuleExecutionOption.YES is set for KieSessionConfiguration when using fireAllRules(). I mean is it able to fire the timer rules and keep the working memory/Drools engine always active with fireAllRules() (invoke after each fact insert).

I heard like fireAllRules() will block the currently executing thread and takes the control,

Please clarify if I missing anything in understanding.

Manjunath S Paramesan

unread,
Apr 17, 2018, 8:59:31 PM4/17/18
to Drools Usage
Hi Srinivas, 

From what I know fireUntilHalt() will block the current thread. Facts/events can be inserted while is session is active in another thread. If you run in active mode, used a dedicated thread.

Drools has an internal state machine to determine the state of the engine. As far as I know fireAllRules does not block the current executing thread indefinitely. It method call returns a fireCount (no of rules matched).  

If you wish to avoid confusion of using TimedRuleExecutionOption and calling the  fireAllRules when a fact is inserted, you could run the session in active mode. 
Reply all
Reply to author
Forward
0 new messages