2011/4/20 Esteban Aliverti
<esteban.aliverti@gmail.com>
@Wolfgang, maybe I need to update the documentation to explicitly inform about this behavior :).
Please do.
The agent doesn't make anything special to sync the sessions with the kbase. If you add a rule by hand to an existing kbase, all the session from this kbase will automatically detect the changes.
Now I'm working in a helper class to create and apply change-set in a programatic way. So if you don't want kbases to be automatically modified when a resource chages, you can use this helper class.
There must be a way to avoid sudden changes in a running stateful session by KAgent "pushing" an updated KBase. Otherwise I don't think you can use KAgent without risks. Actually, I'd opt for a "pull" behavour" being the default with stateful session but it may be too late for that.
Cheers
Wolfgang
@Wolfgang: if you are using drools.agent.newInstance=true (the default configuration), then whenever a change-set is applied, either because you explicitly force the agent to do so, or because a monitored resource changes, the kbase inside the agent is thrown away an a new kbase is created. So you need to get the kbase from the agent and retrieve a fresh session from it.
Would you please point me to the doc where it says "and each stateful session ... is refreshed"?
If true, this were an extremely risky operation. Consider a stateful session whizzing along and - smack! - rules change right in the middle of a sequence of firings. Shudder.
-W
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users