-
1. Re: Can I add new assets (BPMN workflows) to an existing RuntimeManager?
swiderski.maciej Mar 5, 2014 2:25 AM (in response to jkranes)It should be possible to alter RuntimeManager kbase via RuntimeEnvironment. You can cast RuntimeManager to InternalRuntimeManager to get hold of RuntimeEnvironment, next get KieBase out of the runtime environment and you should be able to add resources into that KieBase which should be visible to sessions managed by runtime manager.
HTH
-
2. Re: Can I add new assets (BPMN workflows) to an existing RuntimeManager?
jkranes Mar 5, 2014 10:08 AM (in response to swiderski.maciej)From KieBase I don't see any methods to add a resource. However if I cast the RuntimeEnvironment as SimpleRuntimeEnvironment there is an addResource() method. Does that seem like the right way to do it?
Thanks,
Jon
-
3. Re: Can I add new assets (BPMN workflows) to an existing RuntimeManager?
swiderski.maciej Mar 5, 2014 2:28 PM (in response to jkranes)addResource is use to add them before it is used, so it won't have any impact on already existing kbase. Try following, although keep in mind that this is using impl classes so might be changed in the future.
RuntimeEnvironment env = ((InternalRuntimeManager) manager).getEnvironment();
KieBase base = env.getKieBase();
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("BPMN2-CustomTask.bpmn2"), ResourceType.BPMN2);
((InternalKnowledgeBase)base).getRuleBase().addPackages(((KnowledgeBuilderImpl)kbuilder).getPackageBuilder().getPackages());
HTH