I am new to jbpm6. I was able to configure and run a single service task with Custom workitem handler. However, when i try to configure multiple service tasks within a single process, it doesn't work. Can somebody please help? Thanks in advance !
Below is my working code for a single service task.
<itemDefinition id="_sItem" structureRef="String" />
<itemDefinition id="_2_InMessageType" structureRef="java.lang.String" />
<message id="_2_InMessage" itemRef="_2_InMessageType" />
<interface id="_handlingServiceInterface" name="myService">
<operation id="_handlingServiceOperation" name="">
<inMessageRef>_2_InMessage</inMessageRef>
</operation>
</interface>
<process id="SingleNode_Process" isExecutable="true"
processType="Private" name="Service Process">
<property id="s" itemSubjectRef="_2_InMessageType" />
<startEvent id="start-state" name="Start" />
<serviceTask id="node" name="myservice" implementation="Other"
operationRef="_handlingServiceOperation">
</serviceTask>
<endEvent id="end-state" name="End">
<terminateEventDefinition />
</endEvent>
<sequenceFlow id="flow_N1000C" sourceRef="start-state"
targetRef="node" />
<sequenceFlow id="flow_N10017" sourceRef="node"
targetRef="end-state" />
</process>
ProcessInstance processInstance = null;
KieHelper kieHelper = new KieHelper();
KieBase kbase = kieHelper.addResource(ResourceFactory
.newClassPathResource("test.bpmn"))
.build();
KieSession ksession = kbase.newKieSession();
try{
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new MyTaskHandler());
}
catch (Exception ex){
System.err.println("WorkitemHandler==>"+ex.toString());
}
try{
processInstance = ksession.startProcess("SingleNode_Process");
}
catch(WorkflowRuntimeException e){
System.err.println("processInstance Exception ==>"+e.toString());
}
ksession.dispose();
I would like to have multiple servicetask pointing to different Custom WorkItemHandlers, above.
In this case you overrode the "Service Task" node. What you need to do is write a separate work item handler. The documentaion is here
Basic steps are:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.