cwrwatson
cwrwatson

Reputation: 61

JBoss Drools checks conditions once

I have implemented Drools into my Java Project. All the rules fire but the conditions only get checked once immediately after being fired.

Is this the way Drools behaves? I need it to be constantly checking a boolean for any changes.

Upvotes: 0

Views: 728

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

That's how a forward-chaining rule engine behaves (which is extremely efficient).

If your fact changes (so if the result of it's boolean property/method changes), the rule engine should be notified by workingMemory.updated(fact, factHandle). The rule engine will then fire all the rules (and not a single rule more) which need to be fired based on that change.

Here's a diagram to explain why this can make your app a lot more scalable because it has to run a lot less code.

Upvotes: 2

Related Questions