1、userTask調用邏輯
- 接口調用:
- 從接口(resources)進入
- 實現類(xxxImpl)
- Executor.execute(new xxxCmd())
- xxxCmd中執行execute()方法
- 內部創建調用:(BpmnParser是關鍵調用類)
- xxxCmd 執行邏輯調用
- 獲取TaskManager(可選):TaskManager taskManager = commandContext.getTaskManager();
- 獲取TaskEntity:通過taskManager.findTaskById(id)
- taskEntity.update()/delete()....
- fireEvent( eventName ) :最後操作都是通過fireEvent獲取到對應的Listener通過觀察者模式進行調用。
- fireEvent調用邏輯:
- 獲取ExecutionEntity / (CoreExecution):Context .getCommandContext() .getExecutionManager() .findExecutionById(executionId);
- 包裝對應taskListener+實例(delegateTask)+根據實例的executionId獲取的execution,得到TaskListenerInvocation:new TaskListenerInvocation(taskListener, delegateTask, execution) 注:此處listener會在後續操作中執行對應的notify()方法
- xxxInvocation.handleInvocation(TaskListenerInvocation)真正執行對應操作:Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(listenerInvocation);
- DefaultDelegateInterceptor.handleInvocation(listenerInvocation):通過Interceptor來進行底層操作
- listenerInvocation.proceed()
- 對應執行器(xxxInvocation)執行:xxxInvocation.invoke()
- behaviourInstance.execute(execution)
- 對應listener執行notify()