一、流程图
1选择task类型
2设置回调
可以选择Java Class,也可选择Delegate Expression,由于我使用的是springboot,这里就选择了Delegate Expression
二、任务方法回调方法
需要实现org.camunda.bpm.engine.delegate.JavaDelegate接口
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Service;
@Service("workService")
public class WorkService implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
//当前任务的相关信息都可以从 execution中获取
String processInstanceId = execution.getProcessInstanceId();
System.out.println("干活:"+processInstanceId);
}
}