1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
@Component public class TestJobListener extends JobExecutionListenerSupport {
private static final Logger log = LoggerFactory.getLogger(TestJobListener.class);
@Override public void beforeJob(JobExecution jobExecution) { log.info("before job: {}", jobExecution.getJobInstance().getJobName()); }
@Override public void afterJob(JobExecution jobExecution) { log.info("after job: {}", jobExecution.getJobInstance().getJobName()); } }
@Component public class TestChunkListener extends ChunkListenerSupport {
private static final Logger log = LoggerFactory.getLogger(TestChunkListener.class);
@Override public void beforeChunk(ChunkContext context) { log.info("before chunk: {}", context.getStepContext().getStepName()); }
@Override public void afterChunk(ChunkContext context) { log.info("after chunk: {}", context.getStepContext().getStepName()); }
@Override public void afterChunkError(ChunkContext context) { log.info("after chunk error: {}", context.getStepContext().getStepName()); } }
@Component public class TestReadListener implements ItemReadListener<Ticket> {
private static final Logger log = LoggerFactory.getLogger(TestReadListener.class);
@Override public void beforeRead() { log.info("before read"); }
@Override public void afterRead(Ticket item) { log.info("after read: {}", item); }
@Override public void onReadError(Exception ex) { log.info("read item error: {}", ex.getMessage(), ex); } }
@Component public class TestProcessListener implements ItemProcessListener<Ticket, Ticket> {
private static final Logger log = LoggerFactory.getLogger(TestProcessListener.class);
@Override public void beforeProcess(Ticket item) { log.info("before process: {}", item);
}
@Override public void afterProcess(Ticket item, Ticket result) { log.info("after process: {}", item); }
@Override public void onProcessError(Ticket item, Exception e) { log.info("process: {} error: {}", item, e.getMessage(), e); } }
@Component public class TestWriteListener implements ItemWriteListener<Ticket> {
private static final Logger log = LoggerFactory.getLogger(TestWriteListener.class);
@Override public void beforeWrite(List<? extends Ticket> items) { log.info("before write: {}", items); }
@Override public void afterWrite(List<? extends Ticket> items) { log.info("after write: {}", items); }
@Override public void onWriteError(Exception exception, List<? extends Ticket> items) { log.info("write item error: {}", exception.getMessage(), exception); } }
|