Spring Boot + Camunda Service Task - Delegate Expression Example
Implementation Types:
- Java Delegate
- Expression
- Delegate Expression
- External Service Task
- Connector
In this tutorial we will be implementing service task using expression delegate.

Video
This tutorial is explained in the below Youtube Video.Spring Boot Camunda Tutorials
Spring Boot + Camunda Hello World Example. Spring Boot + Camunda Script Task Example. Spring Boot + Camunda Service Task - Java Delegate Example. Spring Boot + Camunda Service Task - Delegate Expression Example. Spring Boot + Camunda Service Task - Expression Example.
Implementation
Download the source code we had implemented in Spring Boot + Camunda Service Task - Java Delegate Example.The maven project we will be creating is as follows-


This is why we should use delegate expression instead of the fully qualified java class name. Create a new class named ConfirmationEmailExpressionDelegate. This will be similar to the previous ConfirmationEmailDelegate class we had created.
package com.example.workflow.expression.delegate; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; public class ConfirmationEmailExpressionDelegate implements JavaDelegate { @Override public void execute(DelegateExecution execution) throws Exception { System.out.println("Sending mail that transaction of order of amount " + execution.getVariable("orderTotal") + " is a " + execution.getVariable("paymentStatus")); } }