Delegate expression not available

Hello community - I have a strange behavior which I want to understand.

I have a process which starts with a start event and then forks two activities after a parallel gateway. The first activity does some processing and in case of any technical failure, it sets a variable in the delegate. the control moves ahead and based on the variable set, I set up a timer which gets fired and that calls the same activity which encountered error. The time goes into the error state reporting:

org.camunda.bpm.engine.ProcessEngineException: Unknown property used in expression: ${emailSenderDelegate}. Cause: Cannot resolve identifier ‘emailSenderDelegate’

Here is the process diagram:

As can be seen above, the flow passed through the same delegate successfully. I was wondering if I am doing something wrong?

I know that this is not the recommended way to setup retries and technical failures should be handled via Incidents but for a small piece of our process, we have this requirement. I am open to suggestions about the alternates as well from anyone.

Thanks in advance.

1 Like

How did you use that? Can you post some pics of element configuration? Looks like you are trying to use expression like ‘${emailSenderDelegate}’ in wrong place. Maybe you wanted to use Delegate Expression ? Or you are setting up this variable/service bean after invoking next/current service. Can you attache bpmn xml file?

Hello @jankowskirobert - Thank you for your time, could you please have a look at the post:

I have attached the screenshot over there and the model XML as well.

Thank you once again and looking forward.

By the way, had there been any issue with Delegate Expression definition, the process would not have reached to the point where it encountered error, right?

I think this has something to do with context and once the job picks up the flow, it is not able to find the expression in the context in which it is operating.

I am using 7.14.0-ee version.

It might be better to show some code. I mean, that java delegates it’s crucial to find out solution.

I run this proces and it’s working fine with simple beans like singleton with nothing in execute method

@Component(“deleteSubscribersDelegate”)
public class TestB1 implements JavaDelegate {
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
}
}

(Screen is from my privet selfmade ‘enterprise’ dashboard so i can show you historical processes)

Hello @jankowskirobert - All my delegates are extending a base delegate and I am setting some variables inside these delegates, please see below the base delegate:

@Override
	public final void execute(DelegateExecution delegateExecution) throws Exception {

	preExecute(delegateExecution);

	Status status = Status.OK;
	try {
		log.info("executing the process delegate {}", this.getClass().getName());
		doExecute(delegateExecution);
	} catch (InvalidInputException e) {
		log.error("Error occurred in the delegate class {} with message :", this.getClass().getName(), e.getMessage());
		status = Status.ERROR;
	}

	postExecute(delegateExecution, status);

}

protected void doExecute(DelegateExecution delegateExecution) {
}

protected void preExecute(DelegateExecution delegateExecution) {

}

protected void postExecute(DelegateExecution delegateExecution, Status status) {
	// set variables here for the processing of error, ok or retry cases

	ExtensionElements elements = delegateExecution.getBpmnModelElementInstance().getExtensionElements();

	if (status == Status.OK) {
		log.info("status is OK, returning variable {} with value {}", getResultVariableName(), Status.OK.getValue());
		delegateExecution.setVariable(getResultVariableName(), Status.OK.getValue());
		delegateExecution.setVariable(getRetryCountVariableName(), 0);

	} else if (status == Status.ERROR) {
		log.info("status is ERROR, checking the value of the variable '{}' for current retry count. Total retries configured are '{}'.", getRetryCountVariableName(), getRetryCount());
		// check if retry count is valid and if not, send error status
		Integer retryCount = ObjectUtils.defaultIfNull((Integer) delegateExecution.getVariable(getRetryCountVariableName()), Integer.valueOf(0));
		log.info("Retry count executed up till now are '{}'.", retryCount);

		if (retryCount < getRetryCount()) {

			log.info("Retry count executed up till now is less than total retry counts. Setting '{}' value to '{}'", getRetryCountVariableName(), (retryCount + 1));
			delegateExecution.setVariable(getRetryCountVariableName(), (retryCount + 1));
			delegateExecution.setVariable(getResultVariableName(), Status.RETRY.getValue());

		} else if (retryCount == getRetryCount()) { // if retries are exhausted, create error so a user task is created

			log.info("Retries are exhausted, setting the state of variable '{}' to '{}'", getResultVariableName(), Status.ERROR.getValue());
			delegateExecution.setVariable(getResultVariableName(), Status.ERROR.getValue());
			delegateExecution.setVariable(getRetryCountVariableName(), 0);
		}
	}

}

please see the child delegate which is causing issue once the token is stopped at the timer catch event (any value can be set for these properties being returned but all delegates inside the same process need to have the same values so they become related via same variable names):

@Component
@Slf4j
public class EmailSenderDelegate extends CloudTalkDelegate {

@Override
protected void doExecute(DelegateExecution delegateExecution) {
	log.info("trying to send email.....................");
	throw new SAASRuntimeException("error sending email....");
}

@Override
protected String getResultVariableName() {
	return Constants.ProcessVars.VAR_FINALIZE_RESULT;
}

@Override
protected Integer getRetryCount() {
	return Constants.ProcessVars.FINALIZE_MAX_RETRY_COUNT;
}

@Override
protected String getRetryCountVariableName() {
	return Constants.ProcessVars.VAR_FINALIZE_RETRY_COUNT;
}

}

Please see the model XML:

<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1xdy9ku" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.5.0">
  <bpmn:process id="cloudtalk_finalize" name="cloudtalk_finalize" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1" name="Start Finalize">
      <bpmn:outgoing>Flow_0kzsh9o</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:sequenceFlow id="Flow_0kzsh9o" sourceRef="StartEvent_1" targetRef="Gateway_1uz07ce" />
    <bpmn:parallelGateway id="Gateway_1uz07ce">
      <bpmn:incoming>Flow_0kzsh9o</bpmn:incoming>
      <bpmn:outgoing>Flow_067h6sb</bpmn:outgoing>
      <bpmn:outgoing>Flow_0fsoaco</bpmn:outgoing>
    </bpmn:parallelGateway>
    <bpmn:sequenceFlow id="Flow_067h6sb" sourceRef="Gateway_1uz07ce" targetRef="Activity_1adlvf8" />
    <bpmn:sequenceFlow id="Flow_0fsoaco" sourceRef="Gateway_1uz07ce" targetRef="Activity_1g8eeqt" />
    <bpmn:parallelGateway id="Gateway_07q221k">
      <bpmn:incoming>Flow_1o097lz</bpmn:incoming>
      <bpmn:incoming>Flow_1182nyz</bpmn:incoming>
      <bpmn:outgoing>Flow_0b4db0o</bpmn:outgoing>
    </bpmn:parallelGateway>
    <bpmn:endEvent id="Event_18zsyqi" name="End Finalize">
      <bpmn:incoming>Flow_0b4db0o</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_0b4db0o" sourceRef="Gateway_07q221k" targetRef="Event_18zsyqi" />
    <bpmn:serviceTask id="Activity_1adlvf8" name="Send Email" camunda:delegateExpression="${emailSenderDelegate}" camunda:dealegateExpression="${emailSenderDelegate}">
      <bpmn:incoming>Flow_067h6sb</bpmn:incoming>
      <bpmn:incoming>Flow_1giv1z7</bpmn:incoming>
      <bpmn:incoming>Flow_1cwl5ms</bpmn:incoming>
      <bpmn:outgoing>Flow_1fiko63</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:serviceTask id="Activity_1g8eeqt" name="Send Async Callback" camunda:delegateExpression="${callbackDelegate}">
      <bpmn:incoming>Flow_0fsoaco</bpmn:incoming>
      <bpmn:incoming>Flow_0vklk79</bpmn:incoming>
      <bpmn:incoming>Flow_0527w9t</bpmn:incoming>
      <bpmn:outgoing>Flow_0pxq5ec</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:exclusiveGateway id="Gateway_0ta8y7r">
      <bpmn:incoming>Flow_0a7c5d0</bpmn:incoming>
      <bpmn:incoming>Flow_1fiko63</bpmn:incoming>
      <bpmn:outgoing>Flow_1o097lz</bpmn:outgoing>
      <bpmn:outgoing>Flow_0xxi3rf</bpmn:outgoing>
      <bpmn:outgoing>Flow_1jq4l58</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="Flow_1o097lz" name="OK" sourceRef="Gateway_0ta8y7r" targetRef="Gateway_07q221k">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'OK'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:exclusiveGateway id="Gateway_16nyodo">
      <bpmn:incoming>Flow_0pxq5ec</bpmn:incoming>
      <bpmn:incoming>Flow_1d1pwt3</bpmn:incoming>
      <bpmn:outgoing>Flow_1182nyz</bpmn:outgoing>
      <bpmn:outgoing>Flow_0bp6ztk</bpmn:outgoing>
      <bpmn:outgoing>Flow_1x5zbgm</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="Flow_1182nyz" name="OK" sourceRef="Gateway_16nyodo" targetRef="Gateway_07q221k">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'OK'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_0xxi3rf" name="ERROR" sourceRef="Gateway_0ta8y7r" targetRef="Activity_1giecef">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'ERROR'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:userTask id="Activity_1giecef" name="Review">
      <bpmn:incoming>Flow_0xxi3rf</bpmn:incoming>
      <bpmn:outgoing>Flow_0fngbzi</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:sequenceFlow id="Flow_1jq4l58" name="RETRY" sourceRef="Gateway_0ta8y7r" targetRef="Event_0nnkgmg">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'RETRY'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:intermediateCatchEvent id="Event_0nnkgmg" name="Wait &#10;20 sec">
      <bpmn:incoming>Flow_1jq4l58</bpmn:incoming>
      <bpmn:outgoing>Flow_1cwl5ms</bpmn:outgoing>
      <bpmn:timerEventDefinition id="TimerEventDefinition_0f64r34">
        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT20S</bpmn:timeDuration>
      </bpmn:timerEventDefinition>
    </bpmn:intermediateCatchEvent>
    <bpmn:userTask id="Activity_17tdehq" name="Review">
      <bpmn:incoming>Flow_1x5zbgm</bpmn:incoming>
      <bpmn:outgoing>Flow_1puenjo</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:exclusiveGateway id="Gateway_1xie74y">
      <bpmn:incoming>Flow_0fngbzi</bpmn:incoming>
      <bpmn:outgoing>Flow_1giv1z7</bpmn:outgoing>
      <bpmn:outgoing>Flow_0a7c5d0</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="Flow_0fngbzi" sourceRef="Activity_1giecef" targetRef="Gateway_1xie74y" />
    <bpmn:sequenceFlow id="Flow_1giv1z7" name="RETRY" sourceRef="Gateway_1xie74y" targetRef="Activity_1adlvf8">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'RETRY'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:exclusiveGateway id="Gateway_1oue2me">
      <bpmn:incoming>Flow_1puenjo</bpmn:incoming>
      <bpmn:outgoing>Flow_0vklk79</bpmn:outgoing>
      <bpmn:outgoing>Flow_1d1pwt3</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="Flow_1puenjo" sourceRef="Activity_17tdehq" targetRef="Gateway_1oue2me" />
    <bpmn:sequenceFlow id="Flow_0vklk79" name="RETRY" sourceRef="Gateway_1oue2me" targetRef="Activity_1g8eeqt">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'RETRY'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:intermediateCatchEvent id="Event_06nhih0" name="Wait &#10;20 sec">
      <bpmn:incoming>Flow_0bp6ztk</bpmn:incoming>
      <bpmn:outgoing>Flow_0527w9t</bpmn:outgoing>
      <bpmn:timerEventDefinition id="TimerEventDefinition_06v078o">
        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT20S</bpmn:timeDuration>
      </bpmn:timerEventDefinition>
    </bpmn:intermediateCatchEvent>
    <bpmn:sequenceFlow id="Flow_0527w9t" sourceRef="Event_06nhih0" targetRef="Activity_1g8eeqt" />
    <bpmn:sequenceFlow id="Flow_0bp6ztk" name="RETRY" sourceRef="Gateway_16nyodo" targetRef="Event_06nhih0">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'RETRY'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_1x5zbgm" name="ERROR" sourceRef="Gateway_16nyodo" targetRef="Activity_17tdehq">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'ERROR'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_0pxq5ec" sourceRef="Activity_1g8eeqt" targetRef="Gateway_16nyodo" />
    <bpmn:sequenceFlow id="Flow_1d1pwt3" name="OK" sourceRef="Gateway_1oue2me" targetRef="Gateway_16nyodo">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'OK'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_0a7c5d0" name="OK" sourceRef="Gateway_1xie74y" targetRef="Gateway_0ta8y7r">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${finalize_result == 'OK'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_1fiko63" sourceRef="Activity_1adlvf8" targetRef="Gateway_0ta8y7r" />
    <bpmn:sequenceFlow id="Flow_1cwl5ms" sourceRef="Event_0nnkgmg" targetRef="Activity_1adlvf8" />
    <bpmn:textAnnotation id="TextAnnotation_08txyhz">
      <bpmn:text>Exception thrown will be caught and status will be set automatically</bpmn:text>
    </bpmn:textAnnotation>
    <bpmn:association id="Association_0mntiqb" sourceRef="Activity_1g8eeqt" targetRef="TextAnnotation_08txyhz" />
    <bpmn:textAnnotation id="TextAnnotation_0hn2wgu">
      <bpmn:text>Exception thrown will be caught and status will be set automatically</bpmn:text>
    </bpmn:textAnnotation>
    <bpmn:association id="Association_0d3s8iz" sourceRef="Activity_1adlvf8" targetRef="TextAnnotation_0hn2wgu" />
  </bpmn:process>
  <bpmn:error id="Error_1gmyn48" name="CommunicationException" errorCode="ae.etisalat.saas.isv.cloudtalk.exception.CommunicationException" />
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="cloudtalk_finalize">
      <bpmndi:BPMNEdge id="Flow_1fiko63_di" bpmnElement="Flow_1fiko63">
        <di:waypoint x="500" y="240" />
        <di:waypoint x="665" y="240" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0a7c5d0_di" bpmnElement="Flow_0a7c5d0">
        <di:waypoint x="577" y="138" />
        <di:waypoint x="600" y="200" />
        <di:waypoint x="673" y="232" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="601" y="176" width="17" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1d1pwt3_di" bpmnElement="Flow_1d1pwt3">
        <di:waypoint x="578" y="563" />
        <di:waypoint x="600" y="510" />
        <di:waypoint x="673" y="478" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="601" y="523" width="17" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0pxq5ec_di" bpmnElement="Flow_0pxq5ec">
        <di:waypoint x="500" y="470" />
        <di:waypoint x="665" y="470" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1x5zbgm_di" bpmnElement="Flow_1x5zbgm">
        <di:waypoint x="690" y="495" />
        <di:waypoint x="690" y="540" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="699" y="503" width="41" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0bp6ztk_di" bpmnElement="Flow_0bp6ztk">
        <di:waypoint x="690" y="445" />
        <di:waypoint x="690" y="398" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="701" y="420" width="38" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0527w9t_di" bpmnElement="Flow_0527w9t">
        <di:waypoint x="672" y="380" />
        <di:waypoint x="450" y="380" />
        <di:waypoint x="450" y="430" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="478" y="453" width="78" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0vklk79_di" bpmnElement="Flow_0vklk79">
        <di:waypoint x="545" y="580" />
        <di:waypoint x="450" y="580" />
        <di:waypoint x="450" y="510" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="479" y="593" width="38" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1puenjo_di" bpmnElement="Flow_1puenjo">
        <di:waypoint x="640" y="580" />
        <di:waypoint x="595" y="580" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1giv1z7_di" bpmnElement="Flow_1giv1z7">
        <di:waypoint x="545" y="120" />
        <di:waypoint x="450" y="120" />
        <di:waypoint x="450" y="200" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="479" y="102" width="38" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0fngbzi_di" bpmnElement="Flow_0fngbzi">
        <di:waypoint x="640" y="120" />
        <di:waypoint x="595" y="120" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1jq4l58_di" bpmnElement="Flow_1jq4l58">
        <di:waypoint x="690" y="265" />
        <di:waypoint x="690" y="312" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="701" y="278" width="38" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0xxi3rf_di" bpmnElement="Flow_0xxi3rf">
        <di:waypoint x="690" y="215" />
        <di:waypoint x="690" y="160" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="699" y="183" width="41" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1182nyz_di" bpmnElement="Flow_1182nyz">
        <di:waypoint x="715" y="470" />
        <di:waypoint x="830" y="470" />
        <di:waypoint x="830" y="385" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="768" y="479" width="17" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1o097lz_di" bpmnElement="Flow_1o097lz">
        <di:waypoint x="715" y="240" />
        <di:waypoint x="830" y="240" />
        <di:waypoint x="830" y="335" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="768" y="217" width="17" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0b4db0o_di" bpmnElement="Flow_0b4db0o">
        <di:waypoint x="855" y="360" />
        <di:waypoint x="902" y="360" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0fsoaco_di" bpmnElement="Flow_0fsoaco">
        <di:waypoint x="320" y="385" />
        <di:waypoint x="320" y="470" />
        <di:waypoint x="400" y="470" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_067h6sb_di" bpmnElement="Flow_067h6sb">
        <di:waypoint x="320" y="335" />
        <di:waypoint x="320" y="240" />
        <di:waypoint x="400" y="240" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="293" y="340" width="25" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0kzsh9o_di" bpmnElement="Flow_0kzsh9o">
        <di:waypoint x="208" y="360" />
        <di:waypoint x="295" y="360" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1cwl5ms_di" bpmnElement="Flow_1cwl5ms">
        <di:waypoint x="672" y="330" />
        <di:waypoint x="450" y="330" />
        <di:waypoint x="450" y="280" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="172" y="342" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="159" y="385" width="65" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_1dl4feh_di" bpmnElement="Gateway_1uz07ce">
        <dc:Bounds x="295" y="335" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_1en59kf_di" bpmnElement="Gateway_07q221k">
        <dc:Bounds x="805" y="335" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_18zsyqi_di" bpmnElement="Event_18zsyqi">
        <dc:Bounds x="902" y="342" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="890" y="385" width="61" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1d81ku7_di" bpmnElement="Activity_1adlvf8">
        <dc:Bounds x="400" y="200" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0n0twz4_di" bpmnElement="Activity_1g8eeqt">
        <dc:Bounds x="400" y="430" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_0ta8y7r_di" bpmnElement="Gateway_0ta8y7r" isMarkerVisible="true">
        <dc:Bounds x="665" y="215" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_16nyodo_di" bpmnElement="Gateway_16nyodo" isMarkerVisible="true">
        <dc:Bounds x="665" y="445" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0n1rvhr_di" bpmnElement="Activity_1giecef">
        <dc:Bounds x="640" y="80" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1v6wbxd_di" bpmnElement="Event_0nnkgmg">
        <dc:Bounds x="672" y="312" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="713" y="316" width="34" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0f6ibfo_di" bpmnElement="Activity_17tdehq">
        <dc:Bounds x="640" y="540" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_1xie74y_di" bpmnElement="Gateway_1xie74y" isMarkerVisible="true">
        <dc:Bounds x="545" y="95" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_1oue2me_di" bpmnElement="Gateway_1oue2me" isMarkerVisible="true">
        <dc:Bounds x="545" y="555" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0bhdt6r_di" bpmnElement="Event_06nhih0">
        <dc:Bounds x="672" y="362" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="713" y="366" width="34" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="TextAnnotation_08txyhz_di" bpmnElement="TextAnnotation_08txyhz">
        <dc:Bounds x="210" y="540" width="140" height="55" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="TextAnnotation_0hn2wgu_di" bpmnElement="TextAnnotation_0hn2wgu">
        <dc:Bounds x="210" y="140" width="140" height="55" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Association_0mntiqb_di" bpmnElement="Association_0mntiqb">
        <di:waypoint x="400" y="492" />
        <di:waypoint x="294" y="540" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Association_0d3s8iz_di" bpmnElement="Association_0d3s8iz">
        <di:waypoint x="400" y="229" />
        <di:waypoint x="260" y="200" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

There is another case where I am getting this exception and that case is when I modify the process from cockpit (using EE trial version). In this case, I have simple 4 activities, each activity having its own delegate and it is randomly throwing exceptions. Let suppose the token comes at step1, exception occurs and as there is asyc continuation, the job retries for specified number of times and after retries, it is exhausted bringing process instance into incident. I modify this instance from Cockpit and click on the next step (Step2) of that process and use “Start After” option.

The next step starts but my delegate is never called. The step2 job expires as well and can be seen from the Cockpit but my code never gets called. The engine creates incident now at step2 and showing this exception which i mentioned.

Ok so as I understand, that error is intentionally thrown by that delegate? If so i rather catch it there and parse it to some BpmnError class instead of RuntimeException (Remember that java exception classes are for code internally but bpmn errors means something for business side - so if there is a drawn path for me thats mean some business need that). In result I also suggest to refactor diagram to be more readable for bpmn analyst like this:
Screenshot 2021-02-21 at 23.21.35

So to resolve it on my machine i just changed Exception to BpmnError

throw new BpmnError(“FAILED”,“error sending email…”);

And i just used it on diagram

Maybe i do not understand the whole point if so please ignore my responses. Also correct me if i wrong.

cheers,

Hello @jankowskirobert - First of all, thank you very much for your support and time, really appreciate that.

BPMN error is an option but that is specific to business errors of the process. I was reluctant to use that due to that reason and was trying to explore options of how to handle technical failures. Now, as per the guidelines, technical failures shall be left alone and should be handled via an incident creation, which is automatic in case we opt for asynchronous continuation. That is what I wanted to see.

I feel that I am missing something while handling the incident via Cockpit. I simply click on the process in error to see its details, go to the modify tab of the table and move the token to some activity ahead in the model. This should not crash right? It crashes at this point with “Unknown property used in expression”. That is the challenge as I don’t want the BPMNError to be thrown in case of technical failures.