Commit 48fdc61c by huangfusuper

快速失败时,执行结束事件

parent 019588d9
...@@ -4,11 +4,14 @@ import com.byit.enums.EmailEnum; ...@@ -4,11 +4,14 @@ import com.byit.enums.EmailEnum;
import com.byit.enums.FlowPropertyEnum; import com.byit.enums.FlowPropertyEnum;
import com.byit.enums.RunRecordingEnum; import com.byit.enums.RunRecordingEnum;
import com.byit.enums.task.RunResultEnum; import com.byit.enums.task.RunResultEnum;
import com.byit.event.EndFlowEvent;
import com.byit.model.*; import com.byit.model.*;
import com.byit.service.*; import com.byit.service.*;
import com.byit.service.mapservice.RunRecordingAndLogService; import com.byit.service.mapservice.RunRecordingAndLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.net.InetAddress; import java.net.InetAddress;
...@@ -23,13 +26,14 @@ import java.util.stream.Collectors; ...@@ -23,13 +26,14 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@Slf4j @Slf4j
public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService { public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService, ApplicationEventPublisherAware {
public static final String TRIGGER_MSG = "任务执行超时,被强制执行快速失败!"; public static final String TRIGGER_MSG = "任务执行超时,被强制执行快速失败!";
private final JobTaskRunLogService jobTaskRunLogService; private final JobTaskRunLogService jobTaskRunLogService;
private final RunRecordingService runRecordingService; private final RunRecordingService runRecordingService;
private final NodeVersionService nodeVersionService; private final NodeVersionService nodeVersionService;
private final JobTaskService jobTaskService; private final JobTaskService jobTaskService;
private final FlowService flowService; private final FlowService flowService;
private ApplicationEventPublisher applicationEventPublisher;
public RunRecordingAndLogServiceImpl(JobTaskRunLogService jobTaskRunLogService, RunRecordingService runRecordingService, public RunRecordingAndLogServiceImpl(JobTaskRunLogService jobTaskRunLogService, RunRecordingService runRecordingService,
NodeVersionService nodeVersionService, JobTaskService jobTaskService, FlowService flowService) { NodeVersionService nodeVersionService, JobTaskService jobTaskService, FlowService flowService) {
...@@ -79,6 +83,7 @@ public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService ...@@ -79,6 +83,7 @@ public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService
runRecording.setFlowRunResult(RunRecordingEnum.RUN_FLOW_FAILURE.getCode()); runRecording.setFlowRunResult(RunRecordingEnum.RUN_FLOW_FAILURE.getCode());
runRecording.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode()); runRecording.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode());
runRecordingService.updateRunRecordingById(runRecording); runRecordingService.updateRunRecordingById(runRecording);
applicationEventPublisher.publishEvent(new EndFlowEvent(this,runRecording.getFlowId()));
//筛选虚节点 //筛选虚节点
List<JobTask> virtualTasks = byRunId.stream().filter(task -> "0".equals(task.getIsVirtual())).collect(Collectors.toList()); List<JobTask> virtualTasks = byRunId.stream().filter(task -> "0".equals(task.getIsVirtual())).collect(Collectors.toList());
...@@ -142,4 +147,9 @@ public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService ...@@ -142,4 +147,9 @@ public class RunRecordingAndLogServiceImpl implements RunRecordingAndLogService
} }
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment