I have a simple BPMN that has a Service Task followed by a User Task.
The Service Task references an instantiable JavaDelegate, that simply logs a message.
When I start an instance of the definition, the JavaDelegate is executed, but the instance immediately ends. The User Task never appears in the Tasklist.
What am I doing wrong here?
Niall
May 2, 2018, 2:52pm
2
Can you upload you bpmn model.
If i where to guess i would say you’re using a Manual Task
When you intention is better served by using a User Task
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn=“http://www.omg.org/spec/BPMN/20100524/MODEL ” xmlns:bpmndi=“http://www.omg.org/spec/BPMN/20100524/DI ” xmlns:di=“http://www.omg.org/spec/DD/20100524/DI ” xmlns:dc=“http://www.omg.org/spec/DD/20100524/DC ” xmlns:camunda=“http://camunda.org/schema/1.0/bpmn ” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance ” id=“Definitions_1” targetNamespace=“http://bpmn.io/schema/bpmn ” exporter=“Camunda Modeler” exporterVersion=“1.11.3”>
<bpmn:process id=“Service_Task_Delegate” name=“Service Task Delegate” isExecutable=“true”>
<bpmn:startEvent id=“StartEvent”>
bpmn:outgoing SequenceFlow_1</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id=“SequenceFlow_1” sourceRef=“StartEvent” targetRef=“Service_Task” />
<bpmn:endEvent id=“EndEvent”>
bpmn:incoming SequenceFlow_3</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id=“SequenceFlow_2” sourceRef=“Service_Task” targetRef=“User_Task” />
<bpmn:serviceTask id=“Service_Task” name=“Service Task” camunda:class=“com.autodesk.workflow.delegates.ServiceActionDelegate”>
bpmn:incoming SequenceFlow_1</bpmn:incoming>
bpmn:outgoing SequenceFlow_2</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id=“SequenceFlow_3” sourceRef=“User_Task” targetRef=“EndEvent” />
<bpmn:userTask id=“User_Task” name=“User Task”>
bpmn:extensionElements
<camunda:formData />
</bpmn:extensionElements>
bpmn:incoming SequenceFlow_2</bpmn:incoming>
bpmn:outgoing SequenceFlow_3</bpmn:outgoing>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id=“BPMNDiagram_1”>
<bpmndi:BPMNPlane id=“BPMNPlane_1” bpmnElement=“Service_Task_Delegate”>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement=“StartEvent”>
<dc:Bounds x=“173” y=“102” width=“36” height=“36” />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id=“SequenceFlow_08j65hc_di” bpmnElement=“SequenceFlow_1”>
<di:waypoint xsi:type=“dc:Point” x=“209” y=“120” />
<di:waypoint xsi:type=“dc:Point” x=“317” y=“120” />
bpmndi:BPMNLabel
<dc:Bounds x=“218” y=“98.5” width=“90” height=“13” />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id=“EndEvent_1ffuz1t_di” bpmnElement=“EndEvent”>
<dc:Bounds x=“672” y=“102” width=“36” height=“36” />
bpmndi:BPMNLabel
<dc:Bounds x=“645” y=“141” width=“90” height=“13” />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id=“SequenceFlow_1ht1rky_di” bpmnElement=“SequenceFlow_2”>
<di:waypoint xsi:type=“dc:Point” x=“417” y=“120” />
<di:waypoint xsi:type=“dc:Point” x=“485” y=“120” />
bpmndi:BPMNLabel
<dc:Bounds x=“406” y=“98.5” width=“90” height=“13” />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id=“ServiceTask_0ktkftf_di” bpmnElement=“Service_Task”>
<dc:Bounds x=“317” y=“80” width=“100” height=“80” />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id=“SequenceFlow_1w0so3r_di” bpmnElement=“SequenceFlow_3”>
<di:waypoint xsi:type=“dc:Point” x=“585” y=“120” />
<di:waypoint xsi:type=“dc:Point” x=“672” y=“120” />
bpmndi:BPMNLabel
<dc:Bounds x=“628.5” y=“98.5” width=“0” height=“13” />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id=“UserTask_0o2gcsb_di” bpmnElement=“User_Task”>
<dc:Bounds x=“485” y=“80” width=“100” height=“80” />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
And here’s the JavaDelegate:
package com.autodesk.workflow.delegates;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServiceActionDelegate implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(ServiceActionDelegate.class);
public void execute(DelegateExecution execution) throws Exception {
logger.info("ProcessInstanceId [" + execution.getProcessInstanceId() + "] ProcessDefinitionId [" +
execution.getProcessDefinitionId() + "]");
}
}
Niall
May 3, 2018, 7:30am
6
The XML you posted is not rendering into a BPMN model. Could you upload the file itself.
I can’t see any reason from the picture that it wouldn’t wait at the user task so i’m going to need to run it locally to find out.
1 Like
Hi Niall, Thank you for looking at this. I’ll upload the file right now.
ServiceTask_EmptyDelegate.bpmn (3.5 KB)
I renamed the JavaDelegate, and confirmed it is executed.
Niall
May 3, 2018, 2:01pm
9
I deployed that model and it ran as expected and stopped at the user task - you can see the token waiting in cockpit:
1 Like
Since renaming the delegate, I too see what you do, that the User Task is created and waiting to be claimed. I cannot explain why this was not working before, but I am glad it is working as I would expect. Thank you for confirmed what I expected!