JBoss Community

Re: KnowledgeBase loading on demand

created by Maciej Swiderski in jBPM - View the full discussion

Then you could manually operate on the knowledge base, something like this:

 

 

      KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
            
     // add you process definitions here...
     kbuilder.add(ResourceFactory.newFileResource(subfile), ResourceType.BPMN2);
            
     kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
 
 
     // if you like to remove it you can remove the package
     kbase.removeKnowledgePackage(packageName);

 

So you can load the process definitions from whatever source you want, if not already supported by ResourceFactory you can implement your own...

 

Please nore that building knowledge base is considered a heavy operation and should be rather reused instead of rebuilt frequently.

 

HTH

Reply to this message by going to Community

Start a new discussion in jBPM at Community