org.springframework.batch.core.JobExecutionListener Java Examples

The following examples show how to use org.springframework.batch.core.JobExecutionListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BatchConfig.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Bean
public Job importUserJob(JobBuilderFactory jobs, Step step1, Step step2, JobExecutionListener listener) {
       return jobs.get("importUserJob")
               .incrementer(new RunIdIncrementer())
               .listener(listener)
               .flow(step1)
               .next(step2)
               .end()
               .build();
 }
 
Example #2
Source File: BatchEventAutoConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Bean
@Lazy
@ConditionalOnProperty(prefix = "spring.cloud.task.batch.events.job-execution",
		name = "enabled", havingValue = "true", matchIfMissing = true)
// @checkstyle:on
public JobExecutionListener jobExecutionEventsListener() {
	return new EventEmittingJobExecutionListener(
			this.listenerChannels.jobExecutionEvents(),
			this.taskEventProperties.getJobExecutionOrder());
}
 
Example #3
Source File: TaskBatchEventListenerBeanPostProcessor.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
private void registerJobExecutionEventListener(Object bean) {
	if (bean instanceof AbstractJob && this.applicationContext.containsBean(
			BatchEventAutoConfiguration.JOB_EXECUTION_EVENTS_LISTENER)) {
		JobExecutionListener jobExecutionEventsListener = (JobExecutionListener) this.applicationContext
				.getBean(BatchEventAutoConfiguration.JOB_EXECUTION_EVENTS_LISTENER);

		AbstractJob job = (AbstractJob) bean;
		job.registerJobExecutionListener(jobExecutionEventsListener);
	}
}
 
Example #4
Source File: ImportUserJobConfig.java    From spring-boot-doma2-sample with Apache License 2.0 4 votes vote down vote up
@Bean
public JobExecutionListener importUserJobListener() {
    return new ImportUserJobListener();
}
 
Example #5
Source File: BirthdayMailJobConfig.java    From spring-boot-doma2-sample with Apache License 2.0 4 votes vote down vote up
@Bean
public JobExecutionListener birthdayMailJobListener() {
    return new BirthdayMailJobListener();
}
 
Example #6
Source File: ImportStaffJobConfig.java    From spring-boot-doma2-sample with Apache License 2.0 4 votes vote down vote up
@Bean
public JobExecutionListener importStaffJobListener() {
    return new ImportStaffJobListener();
}
 
Example #7
Source File: JobExecutionListenerRegisterBean.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
public JobExecutionListenerRegisterBean(final JobExecutionListener jobExecutionFinishedJobExecutionListener) {
    this.jobExecutionFinishedJobExecutionListener = jobExecutionFinishedJobExecutionListener;
}
 
Example #8
Source File: JobExecutionListenerRegisterBean.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
private JobExecutionListener[] getJobExecutionListeners() {
    return new JobExecutionListener[]{this.jobExecutionFinishedJobExecutionListener};
}
 
Example #9
Source File: SpringBatchLightminServiceConfiguration.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
@Bean
@Qualifier("jobExecutionFinishedJobExecutionListener")
public JobExecutionListener jobExecutionFinishedJobExecutionListener(
        final SpringBatchLightminCoreConfigurationProperties properties) {
    return new JobExecutionFinishedJobExecutionListener(properties);
}
 
Example #10
Source File: SpringBatchLightminServiceConfiguration.java    From spring-batch-lightmin with Apache License 2.0 4 votes vote down vote up
@Bean
public JobExecutionListenerRegisterBean jobExecutionListenerRegisterBean(
        @Qualifier("jobExecutionFinishedJobExecutionListener") final JobExecutionListener jobExecutionFinishedJobExecutionListener) {
    return new JobExecutionListenerRegisterBean(jobExecutionFinishedJobExecutionListener);
}
 
Example #11
Source File: MetricsConfiguration.java    From spring-boot-starter-batch-web with Apache License 2.0 4 votes vote down vote up
@Override
public Set<JobExecutionListener> jobExecutionListeners() {
	Set<JobExecutionListener> listeners = new HashSet<>();
	listeners.add(metricsListener());
	return listeners;
}
 
Example #12
Source File: TestListenerConfiguration.java    From spring-boot-starter-batch-web with Apache License 2.0 4 votes vote down vote up
@Override
public Set<JobExecutionListener> jobExecutionListeners() {
	Set<JobExecutionListener> listeners = new HashSet<JobExecutionListener>();
	listeners.add(testListener());
	return listeners;
}
 
Example #13
Source File: ListenerProvider.java    From spring-boot-starter-batch-web with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a set of JobExecutionListeners that will be added to each Job. May not return null.
 * 
 * @return Returns a set of JobExecutionListeners that will be added to each Job. May not return null.
 */
public Set<JobExecutionListener> jobExecutionListeners();