flow able如何获取executionId
时间: 2024-05-16 17:13:50 浏览: 10
在 Flowable 中,可以通过以下方式获取 Execution ID:
1. 在流程实例开始时,可以通过 ProcessInstance 对象获取 Execution ID,如下所示:
```
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinitionKey, variables);
String executionId = processInstance.getId();
```
2. 在任务完成时,可以通过 Task 对象获取 Execution ID,如下所示:
```
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String executionId = task.getExecutionId();
```
3. 在监听器中,可以通过 DelegateExecution 对象获取 Execution ID,如下所示:
```
public class ExecutionListenerImpl implements ExecutionListener {
@Override
public void notify(DelegateExecution execution) {
String executionId = execution.getId();
}
}
```
注意:Execution ID 是一个唯一的标识符,用于标识流程实例中的执行路径。在 Flowable 中,每个执行路径都有一个唯一的 Execution ID。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)