Camunda JavaDelegate另一种实现

  • lambada实现
@Configuration
public class CommonDelegate {


    @Bean("test")
    JavaDelegate testDelegate() {
        return execution -> {
            System.out.println("test>>>>>");
            Map<String,String> map = new HashMap<>();
            execution.setVariable("map",map);
            execution.setVariable("jname", UUID.randomUUID().toString());
            execution.setVariable("jage", System.nanoTime());
        };
    }


}

Expression的使用

 

${myBean.doWork(execution)}

@Component("myBean")
public class MyService {

    public void doWork(DelegateExecution execution) {
        System.out.println("myBean:doWork>>>>>>");
        Object jname = execution.getVariable("jname");
        execution.setVariable("jname", jname + "zzzzz");

    }
}

map,jname必須是variables里的变量

 

posted @ 2024-05-10 14:34  洞玄巅峰  阅读(58)  评论(0编辑  收藏  举报