Viraj
Viraj

Reputation: 5411

Drools - Using a global variable in condition and updating it in consequence

I have following question. Hope someone can answer .

In my drools project I'm executing some selection rules and selected objects are added to global list. Then there are another rules which use objects in this global list. I expect Drools to fire those global list dependent rules every time list changes ( when another rule add object to list ). But seems like this not happening on Drools. Does drools track changes done to global variable and resolve rules which depends on them ?

Thanks in Advance !

Upvotes: 0

Views: 5155

Answers (1)

Esteban Aliverti
Esteban Aliverti

Reputation: 6322

From Drools documentation:

Globals are not inserted into the Working Memory, and therefore a global should never be used to establish conditions in rules except when it has a constant immutable value.

Hope it helps,

Upvotes: 3

Related Questions