List of usage examples for org.springframework.batch.core.job AbstractJob registerJobExecutionListener
public void registerJobExecutionListener(JobExecutionListener listener)
From source file:de.codecentric.batch.listener.AddListenerToJobService.java
public void addListenerToJob(AbstractJob job) { if (addProtocolListener) { job.registerJobExecutionListener(protocolListener); }//from ww w .java 2s. co m job.registerJobExecutionListener(runningExecutionTrackerListener); if (addLoggingListener) { job.registerJobExecutionListener(loggingListener); job.registerJobExecutionListener(loggingAfterJobListener); for (String stepName : job.getStepNames()) { AbstractStep step = (AbstractStep) job.getStep(stepName); step.registerStepExecutionListener(loggingListener); } } if (listenerProviders != null) { for (ListenerProvider listenerProvider : listenerProviders) { for (JobExecutionListener jobExecutionListener : listenerProvider.jobExecutionListeners()) { job.registerJobExecutionListener(jobExecutionListener); } for (StepExecutionListener stepExecutionListener : listenerProvider.stepExecutionListeners()) { for (String stepName : job.getStepNames()) { AbstractStep step = (AbstractStep) job.getStep(stepName); step.registerStepExecutionListener(stepExecutionListener); } } } } }