package cn.axzo.workflow.core.engine.job.exception.handle;

import cn.axzo.workflow.common.constant.LogFieldConstants;
import cn.azxo.framework.common.constatns.Constants;
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 org.slf4j.MDC;

@Slf4j
public class CustomAsyncJobLogClearTraceExceptionHandler implements AsyncRunnableExecutionExceptionHandler {

    @Override
    public boolean handleException(JobServiceConfiguration jobServiceConfiguration, JobInfo job, Throwable exception) {
        //执行异常,删除日志字段
        MDC.remove(LogFieldConstants.X_REQUEST_ID);
        MDC.remove(Constants.CTX_LOG_ID_MDC);
        return false;
    }
}
