- create a knowledge builder to load processes from various resources (for example from the classpath or from file system)
- create a knowledge base from the builder
- instantiate a session based on the knowledge base
- start executing processes
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource("ruleflow.rf"), ResourceType.DRF); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); ProcessInstance processInstance = ksession.startProcess("com.sample.MyProcess"); ksession.fireAllRules();
No comments:
Post a Comment