update(REQ-2324) - 解决编译问题
This commit is contained in:
parent
a549e10890
commit
5d7733bbb0
@ -1,69 +0,0 @@
|
||||
package cn.axzo.workflow.core.engine.listener;
|
||||
|
||||
import cn.axzo.workflow.core.engine.event.ErrorInfoEvent;
|
||||
import cn.axzo.workflow.core.engine.event.ErrorInfoEventType;
|
||||
import cn.axzo.workflow.core.listener.BpmnAsyncExecutionErrorEventListener;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
|
||||
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.axzo.workflow.core.engine.event.ErrorInfoEventType.NEW_ERROR;
|
||||
|
||||
/**
|
||||
* 异步任务执行过程发生错误的事件监听器
|
||||
* <p>
|
||||
* 监听{@link ErrorInfoEvent}事件,并调用{@link BpmnAsyncExecutionErrorEventListener}接口的{@code notify(Job,Throwable)}方法
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2024/4/17 16:52
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EngineAsyncExecutionErrorEventListener extends AbstractFlowableEngineEventListener {
|
||||
|
||||
@Resource
|
||||
ObjectProvider<List<BpmnAsyncExecutionErrorEventListener>> errorEventListeners;
|
||||
|
||||
public static final Set<ErrorInfoEventType> ACCEPT_EVENTS =
|
||||
ImmutableSet.<ErrorInfoEventType>builder()
|
||||
.add(NEW_ERROR)
|
||||
.build();
|
||||
|
||||
@Override
|
||||
public void onEvent(FlowableEvent flowableEvent) {
|
||||
if (flowableEvent instanceof ErrorInfoEvent) {
|
||||
ErrorInfoEvent event = (ErrorInfoEvent) flowableEvent;
|
||||
ErrorInfoEventType eventType = (ErrorInfoEventType) flowableEvent.getType();
|
||||
|
||||
if (ACCEPT_EVENTS.contains(eventType)) {
|
||||
switch (eventType) {
|
||||
case NEW_ERROR:
|
||||
getOrderedListeners().forEach(i -> i.notify(event.getJob(), event.getThrowable()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<BpmnAsyncExecutionErrorEventListener> getOrderedListeners() {
|
||||
List<BpmnAsyncExecutionErrorEventListener> orderListeners = new ArrayList<>();
|
||||
errorEventListeners.ifAvailable(orderListeners::addAll);
|
||||
return orderListeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFailOnException() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -16,7 +16,6 @@ import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.job.service.JobService;
|
||||
import org.flowable.job.service.impl.persistence.entity.JobEntity;
|
||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@ -32,12 +31,12 @@ import static cn.axzo.workflow.core.common.code.BpmnTaskRespCode.PROCESS_INSTANC
|
||||
public class BpmnProcessActivityServiceImpl implements BpmnProcessActivityService {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
// @Lazy
|
||||
private RuntimeService runtimeService;
|
||||
@Resource
|
||||
private ExtAxHiTaskInstService extAxHiTaskInstService;
|
||||
@Resource
|
||||
@Lazy
|
||||
// @Lazy
|
||||
private SpringProcessEngineConfiguration processEngineConfiguration;
|
||||
|
||||
private static final String JOB_TRIGGER_ASYNC_NAME = "asyncTrigger";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user