Merge branch 'refs/heads/master' into feature/starter
This commit is contained in:
commit
93a11118f1
@ -13,6 +13,7 @@ import cn.axzo.workflow.core.engine.job.AsyncRejectTaskJobHandler;
|
||||
import cn.axzo.workflow.core.engine.job.AsyncTransferUserTaskJobHandler;
|
||||
import cn.axzo.workflow.core.engine.job.exception.handle.CustomAsyncJobLogClearTraceExceptionHandler;
|
||||
import cn.axzo.workflow.core.engine.job.exception.handle.CustomAsyncRunnableExceptionExceptionHandler;
|
||||
import cn.axzo.workflow.core.engine.job.exception.handle.CustomWorkflowEngineExceptionHandler;
|
||||
import cn.axzo.workflow.core.engine.persistence.CustomMybatisHistoricProcessInstanceDataManager;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessActivityService;
|
||||
import cn.axzo.workflow.core.service.ExtAxHiTaskInstService;
|
||||
@ -88,6 +89,7 @@ public class FlowableConfiguration {
|
||||
configuration.setEnableVerboseExecutionTreeLogging(enableVerboseExecutionTreeLogging);
|
||||
configuration.setCustomAsyncRunnableExecutionExceptionHandlers(Lists.newArrayList(
|
||||
new CustomAsyncJobLogClearTraceExceptionHandler(),
|
||||
new CustomWorkflowEngineExceptionHandler(),
|
||||
new CustomAsyncRunnableExceptionExceptionHandler()));
|
||||
configuration.setCommandContextFactory(new CustomCommandContextFactory());
|
||||
};
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.axzo.workflow.core.engine.job.exception.handle;
|
||||
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.job.api.JobInfo;
|
||||
import org.flowable.job.service.JobServiceConfiguration;
|
||||
import org.flowable.job.service.impl.asyncexecutor.AsyncRunnableExecutionExceptionHandler;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 解决异步任务执行过程中, 抛出的 WorkflowEngineException 正常的业务异常.
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2024/6/26 15:53
|
||||
*/
|
||||
@Slf4j
|
||||
public class CustomWorkflowEngineExceptionHandler implements AsyncRunnableExecutionExceptionHandler {
|
||||
@Override
|
||||
public boolean handleException(JobServiceConfiguration jobServiceConfiguration, JobInfo job, Throwable e) {
|
||||
if (getRootCause(e).getClass().isAssignableFrom(WorkflowEngineException.class)) {
|
||||
log.warn("AsyncApproveTaskJobHandler execute exception info: {}", e.getMessage(), e);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Throwable getRootCause(Throwable throwable) {
|
||||
while (Objects.nonNull(throwable.getCause())) {
|
||||
throwable = throwable.getCause();
|
||||
}
|
||||
return throwable;
|
||||
}
|
||||
}
|
||||
@ -27,6 +27,7 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static cn.axzo.workflow.core.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.core.common.code.BpmnInstanceRespCode.RUNNING_INSTANCE_ONLY_FORECAST;
|
||||
|
||||
|
||||
/**
|
||||
@ -123,7 +124,9 @@ public class FlowNodeForecastService implements InitializingBean {
|
||||
// .includeProcessVariables()
|
||||
.singleResult();
|
||||
}
|
||||
|
||||
if (Objects.isNull(instance)) {
|
||||
throw new WorkflowEngineException(RUNNING_INSTANCE_ONLY_FORECAST);
|
||||
}
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(instance.getProcessDefinitionId());
|
||||
|
||||
// 保持推测出来的节点执行顺序的容器
|
||||
|
||||
Loading…
Reference in New Issue
Block a user