[rules-users] Adding packages to a KnowledgeBase being watched by KnowledgeAgent?

ljnelson ljnelson at gmail.com
Fri Sep 3 15:19:52 EDT 2010


Suppose I have a KnowledgeBase that I've built with the usual factory method. 
I've added nothing to it yet.

I park a KnowledgeAgent on top of it, using the
KnowledgeAgentFactory#newKnowledgeAgent(String, KnowledgeBase,
KnowledgeAgentConfiguration) call.

The KnowledgeAgent now, of course, monitors some resource somewhere and
periodically constructs new KnowledgeBases with the changed stuff it
discovers from monitoring resources.

If I get a handle on one of these KnowledgeBases by periodically asking the
KnowledgeAgent via its #getKnowledgeBase() method:

1. May I add KnowledgePackages "by hand" to it?
2. If I do (1), I assume if the KnowledgeAgent builds a new KnowledgeBase,
the new KnowledgeBase has no knowledge :-) of the packages I just added,
right?
3. Is there any way to tell as an end user when a KnowledgeBase has been
"detached" from a KnowledgeAgent?

I suspect I know the answer--which is that I should configure my
KnowledgeAgent to NOT make new KnowledgeBase instances, by using the
"drools.agent.newInstance" configuration property, which the documentation
says is "hard coded to true" even though in fact that is not true in Drools
5.1.

If I do that, are there any concurrency issues to be aware of?  After all,
the KnowledgeAgent is going to be scanning some files in a separate thread,
and periodically (presumably) updating the KnowledgeBase with their
contents.  What, if any, synchronization or locking do I have to perform if,
while all of that is going on, I wish to add KnowledgePackages to the
KnowledgeBase "by hand"?

Thanks,
Laird
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Adding-packages-to-a-KnowledgeBase-being-watched-by-KnowledgeAgent-tp1414258p1414258.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list