[rules-users] How to check for errors when creating a kBase using kAgent, kAgentConfiguration and kBaseConfiguration
esteban.aliverti at gmail.com
esteban.aliverti at gmail.com
Fri Oct 29 07:41:52 EDT 2010
Hi,
If you are using 5.1 or greater, you can use a KnowledgeAgentEventListener
to be notified when resource's compilation fails. You can create your own
implementation of KnowledgeAgentEventListener, or you can
use DefaultKnowledgeAgentEventListener and override just the methods you
need:
kagent.addEventListener(new DefaultKnowledgeAgentEventListener() {
public void resourceCompilationFailed(ResourceCompilationFailedEvent
event) {
//ResourceCompilationFailedEvent contains a reference to kagent's
kbuilder. You can use it to see what happened.
}
});
Best,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com
On Sun, Oct 24, 2010 at 7:55 PM, Tina Vießmann <tviessmann at stud.hs-bremen.de
> wrote:
> What's the best way for checking for errors when using the following
> code for creating a kbase?
>
>
> // ResourceChangeScanner
> ResourceChangeScannerConfiguration sconf =
>
> ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
> sconf.setProperty("drools.resource.scanner.interval", "10");
> ResourceFactory.getResourceChangeScannerService().configure(sconf);
>
> ResourceFactory.getResourceChangeNotifierService().start();
> ResourceFactory.getResourceChangeScannerService().start();
>
>
> // knowledge base
> KnowledgeBaseConfiguration kbaseConf =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> kbaseConf.setOption(EventProcessingOption.STREAM);
> kbaseConf.setOption(MBeansOption.ENABLED);
> KnowledgeBase kbase =
> KnowledgeBaseFactory.newKnowledgeBase(kbaseConf);
>
>
> // knowledge agent
> KnowledgeAgentConfiguration kagentConf =
> KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
> kagentConf.setProperty("drools.agent.newInstance", "false");
> KnowledgeAgent kagent =
> KnowledgeAgentFactory.newKnowledgeAgent("AITS CEP Engine Agent", kbase,
> kagentConf);
>
>
> kagent.applyChangeSet(ResourceFactory.newClassPathResource(myFile));
>
>
> // session
> fSession = kbase.newStatefulKnowledgeSession();
>
>
> Thank you.
> Tina
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101029/452f88ff/attachment.html
More information about the rules-users
mailing list