[rules-dev] KnowledgeBaseEvent on KnowledgeAgent

Steve Ronderos steve.ronderos at ni.com
Wed May 26 11:34:55 EDT 2010


Hi Ben,

The kbase that is passed into KnowledgeAgentFactory.newKnowledgeAgent is 
used to configure the KnowledgeAgent that is created.  The 
KnowledgeAgentFactory reads the current contents of the KnowledgeBase and 
the configuration of the KnowledgeBase and ensures that future 
KnowledgeBases are set up with the same configuration.

This is useful for setting properties that are specific to a KnowledgeBase 
which you can not set using the KnowledgeAgentConfiguration class.

Please note the differences between the configuration options on the 
following 2 interfaces:
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/apidocs/org/drools/KnowledgeBaseConfiguration.html
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/apidocs/org/drools/agent/KnowledgeAgentConfiguration.html

I believe the reason why your rules are not executing when you get a 
session from the kbase that you provided to the KnowledgeAgentFactory is 
because the kbase provided to the KnowledgeAgentFactory is not modified 
when the agent is built.  Once the agent is built you should use 
agent.getKnowledgeBase().newStatefulKnowledgeSession()

You can read more about how to configure KnowledgeAgents in the 
documentation section 3.2.6: 
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html/ch03.html#d0e1123
The details I mention above are in the text between Example 3.20 and 
Example 3.22.

Hope this helps,
Steve

rules-dev-bounces at lists.jboss.org wrote on 05/26/2010 10:26:17 AM:

> From:
> 
> Mohamed BEN AYED <mohamed.ensi at gmail.com>
> 
> To:
> 
> rules-dev at lists.jboss.org
> 
> Date:
> 
> 05/26/2010 10:28 AM
> 
> Subject:
> 
> Re: [rules-dev] KnowledgeBaseEvent on KnowledgeAgent
> 
> Sent by:
> 
> rules-dev-bounces at lists.jboss.org
> 
> 
> drools 5.0
> -- 
> View this message in context: http://drools-java-rules-engine.
> 
46999.n3.nabble.com/KnowledgeBaseEvent-on-KnowledgeAgent-tp842269p845146.html
> Sent from the Drools - Dev mailing list archive at Nabble.com.
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20100526/700c8316/attachment-0001.html 


More information about the rules-dev mailing list