Skip to content

Commit a60235a

Browse files
committed
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.
1 parent 102f4b7 commit a60235a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-cloud-task-batch/src/main/java/org/springframework/cloud/task/batch/listener/TaskBatchExecutionListener.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
2424
import org.springframework.cloud.task.listener.annotation.BeforeTask;
2525
import org.springframework.cloud.task.repository.TaskExecution;
26+
import org.springframework.core.Ordered;
2627
import org.springframework.util.Assert;
2728

2829
/**
@@ -31,7 +32,7 @@
3132
*
3233
* @author Michael Minella
3334
*/
34-
public class TaskBatchExecutionListener extends JobExecutionListenerSupport {
35+
public class TaskBatchExecutionListener extends JobExecutionListenerSupport implements Ordered {
3536

3637
private static final Log logger = LogFactory.getLog(TaskBatchExecutionListener.class);
3738

@@ -67,4 +68,8 @@ public void beforeJob(JobExecution jobExecution) {
6768
}
6869
}
6970

71+
@Override
72+
public int getOrder() {
73+
return Ordered.HIGHEST_PRECEDENCE;
74+
}
7075
}

0 commit comments

Comments
 (0)