Hi,

I want to create a KnowledgeBase using stream processing mode, getting its resources from an change-set xml and getting the updated when resources are changed. So far I'm aware I need a KnowledgeAgent and a configuration for the kagent and the kbase.
My code is:
// create knowledge base

// knowledge base configuration
KnowledgeBaseConfiguration kbaseConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbaseConf.setOption(EventProcessingOption.STREAM);

// knowledge base
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConf);


// create knowledge agent

// create knowledge agent configuration
KnowledgeAgentConfiguration kagentConf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
//enable incremental knowledge base build
kagentConf.setProperty("drools.agent.newInstance", "false");
//create knowledge agent
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("AITS CEP Engine Agent", kbase, kagentConf);
       
       
// apply change-set XML to knowledge agent
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset.xml"));

//  get updated knowledge base object
kbase = kagent.getKnowledgeBase();
       
// create session
session = kbase.newStatefulKnowledgeSession();

Can it be done in a more compact way?

Thank you! :)
Tina