From a60235ac3a12649f64c9f562f8f85a270f972bca Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Wed, 1 Dec 2021 13:25:27 -0500 Subject: [PATCH] TaskBatcheExecutionListener is now created before other jobexec listeners Resolves #818 This resolves the scenario where a JobExecutionListenerSupport fails before the TaskBatchExecutionListener fires and thus the TASK-BATCH table is not populated. --- .../task/batch/listener/TaskBatchExecutionListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/listener/TaskBatchExecutionListener.java b/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/listener/TaskBatchExecutionListener.java index 47900bcb..46540d38 100644 --- a/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/listener/TaskBatchExecutionListener.java +++ b/spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/listener/TaskBatchExecutionListener.java @@ -23,6 +23,7 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.listener.JobExecutionListenerSupport; import org.springframework.cloud.task.listener.annotation.BeforeTask; import org.springframework.cloud.task.repository.TaskExecution; +import org.springframework.core.Ordered; import org.springframework.util.Assert; /** @@ -31,7 +32,7 @@ import org.springframework.util.Assert; * * @author Michael Minella */ -public class TaskBatchExecutionListener extends JobExecutionListenerSupport { +public class TaskBatchExecutionListener extends JobExecutionListenerSupport implements Ordered { private static final Log logger = LogFactory.getLog(TaskBatchExecutionListener.class); @@ -67,4 +68,8 @@ public class TaskBatchExecutionListener extends JobExecutionListenerSupport { } } + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } }