@Service
public class SendTaskService implements JavaDelegate {
@Autowired
private RuntimeService runtimeService;
@Override
public void execute(DelegateExecution execution) throws Exception {
runtimeService.createMessageCorrelation("receive_task_msg")
.processInstanceBusinessKey("key001")
.correlate();
}
}
// 1.先启动接收
repositoryService.createDeployment().name("接收流程")
.addClasspathResource("bpmn/receive_task.bpmn").deploy();
runtimeService.startProcessInstanceByKey("ReceiveTaskProces", "key001");
// 2.再发送
repositoryService.createDeployment().name("发送流程")
.addClasspathResource("bpmn/send_task.bpmn").deploy();
runtimeService.startProcessInstanceByKey("SendTaskProcess", "key001");