I use camunda-7-to-8-adapter for migration camunda 7 diagram to 8. (GitHub - camunda-community-hub/camunda-7-to-8-migration: A collection of tools to support migration from Camunda Platform 7 to Camunda Platform 8)
I have a huge code base with Java Delegate.
For example i have a code:
@Slf4j
@Component
public class AverageIncomeCalculationDelegate extends OrderDelegate {
@Autowired
private AverageAbsIncomeCalculationService averageAbsIncomeCalculationService;
@Override
public void execute(DelegateExecution execution) {
log.info("Delegate: " + execution.getCurrentActivityName());
Order order = getOrder(execution);
order.setAverageAbsIncome(averageAbsIncomeCalculationService.calculateAverageIncome(order));
setOrder(execution, order);
}
Where i use execution.getCurrentActivityName().
camunda-7-to-8-adapter use ZeebeJobDelegateExecution, realisation of method getCurrentActivityName throws UnsupportedOperationException:
@Override
public String getCurrentActivityName() {
return getBpmnModelElementInstance().getName();
}
@Override
public FlowElement getBpmnModelElementInstance() {
throw new UnsupportedOperationException();
}
OrderDelegate implements JavaDelegate.
How can i get serviceTask name from ZeebeJobDelegateExecution without creating job worker and refactoring code of bpmn diagram?
<bpmn:serviceTask id="Activity_0buupw8" name="MAC2" implementation="##WebService">
<bpmn:extensionElements>
<conversion:message severity="REVIEW">Attribute 'delegateExpression' on 'serviceTask' was mapped. Delegate call to '${macRuleDelegate}' was transformed to job type 'camunda-7-adapter'. Please review your implementation.</conversion:message>
<conversion:message severity="INFO">Unused attribute 'asyncAfter' on 'serviceTask' is removed.</conversion:message>
<zeebe:taskHeaders>
<zeebe:header key="delegateExpression" value="${macRuleDelegate}" />
</zeebe:taskHeaders>
<zeebe:taskDefinition type="camunda-7-adapter" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_1dhrhjf</bpmn:incoming>
<bpmn:outgoing>Flow_1hh22eb</bpmn:outgoing>
</bpmn:serviceTask>