Hi
I have a process involving 3 HumanTask nodes and 2 CustomService nodes. All works fine if I just run one instance of this process, when I try to setup 2 instances, strage things starts to happend. Looks like the processes influence with each other. My question is how to setup session and knowlegde base to support mulitple instances of my process.
I use this strategy to setup my session and prosesses - is this correct?
1) When application starts up we read the knowlegdebase (only done once)
2) After 1 is completed we setup the session (global session reused)
session = kbase.newStatefulKnowledgeSession() - global and reused trough application
3) When we need to start a new process, a new instance is created with the global session
Have tried different solutions, right now this is what's done when starting up a new process instance:
//Register two custom work nodes
session.getWorkItemManager().registerWorkItemHandler("START", new ApplicationWorkManager());
session.getWorkItemManager().registerWorkItemHandler("APPROVED", new ApplicationWorkManager());
//Register Human Task handler
CommandBasedWSHumanTaskHandler handler = new CommandBasedWSHumanTaskHandler(appsession);
session.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
WorkflowProcessInstance process = (WorkflowProcessInstance) appsession.startProcess("no.my.Process",parameters);
With just one active process things are fine, starting a second process - strage things starts to happend. E.g process number 2 skips the first Human Task which is active in process 1. Is the setup I use correct? Shall I just register WorkItemHandler once? How can i reuse my session for difference process instances?
Hope someone can help out here.. I think (and hope) JBPM is able to handle multiple instances of a process.