org.springframework.batch.core.configuration.JobRegistry Java Examples
The following examples show how to use
org.springframework.batch.core.configuration.JobRegistry.
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: JobBuilder.java From spring-batch-rest with Apache License 2.0 | 6 votes |
public static Job registerJob(JobRegistry jobRegistry, Job job) { jobRegistry.unregister(job.getName()); try { jobRegistry.register(new JobFactory() { @Override public Job createJob() { return job; } @Override public String getJobName() { return job.getName(); } }); } catch (Exception e) { throw new RuntimeException("Could not create " + job.getName(), e); } return job; }
Example #2
Source File: TaskJobLauncherCommandLineRunnerFactoryBean.java From spring-cloud-task with Apache License 2.0 | 6 votes |
public TaskJobLauncherCommandLineRunnerFactoryBean(JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs, TaskBatchProperties taskBatchProperties, JobRegistry jobRegistry, JobRepository jobRepository, BatchProperties batchProperties) { Assert.notNull(taskBatchProperties, "taskBatchProperties must not be null"); Assert.notNull(batchProperties, "batchProperties must not be null"); this.jobLauncher = jobLauncher; this.jobExplorer = jobExplorer; Assert.notEmpty(jobs, "jobs must not be null nor empty"); this.jobs = jobs; this.jobNames = taskBatchProperties.getJobNames(); this.jobRegistry = jobRegistry; this.taskBatchProperties = taskBatchProperties; if (StringUtils.hasText(batchProperties.getJob().getNames())) { this.jobNames = batchProperties.getJob().getNames(); } else { this.jobNames = taskBatchProperties.getJobNames(); } this.order = taskBatchProperties.getCommandLineRunnerOrder(); this.jobRepository = jobRepository; }
Example #3
Source File: SpringBatchLightminServiceConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 6 votes |
@Bean public JobCreationListener jobCreationListener( final ApplicationContext applicationContext, final JobRegistry jobRegistry, final AdminService adminService, final SchedulerService schedulerService, final ListenerService listenerService, final JobExecutionListenerRegisterBean jobExecutionListenerRegisterBean) { return new JobCreationListener( applicationContext, jobRegistry, adminService, schedulerService, listenerService, jobExecutionListenerRegisterBean); }
Example #4
Source File: ClassicLightminClientConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 6 votes |
@Bean @ConditionalOnMissingBean(value = {LightminClientRegistratorService.class}) public LightminClientRegistratorService lightminClientRegistratorService( final LightminClientProperties lightminClientProperties, final LightminClientClassicConfigurationProperties lightminClientClassicConfigurationProperties, final JobRegistry jobRegistry, final LightminServerLocatorService lightminServerLocatorService, @Qualifier("serverRestTemplate") final RestTemplate restTemplate) { return new LightminClientRegistratorService( lightminClientProperties, lightminClientClassicConfigurationProperties, restTemplate, jobRegistry, lightminServerLocatorService); }
Example #5
Source File: TaskJobLauncherAutoConfiguration.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Bean public TaskJobLauncherCommandLineRunnerFactoryBean jobLauncherCommandLineRunner( JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs, JobRegistry jobRegistry, JobRepository jobRepository, BatchProperties batchProperties) { TaskJobLauncherCommandLineRunnerFactoryBean taskJobLauncherCommandLineRunnerFactoryBean; taskJobLauncherCommandLineRunnerFactoryBean = new TaskJobLauncherCommandLineRunnerFactoryBean( jobLauncher, jobExplorer, jobs, this.properties, jobRegistry, jobRepository, batchProperties); return taskJobLauncherCommandLineRunnerFactoryBean; }
Example #6
Source File: OnApplicationReadyEventEmbeddedListener.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
public OnApplicationReadyEventEmbeddedListener(final RegistrationBean registrationBean, final JobRegistry jobRegistry, final LightminClientProperties lightminClientProperties) { this.registrationBean = registrationBean; this.jobRegistry = jobRegistry; this.lightminClientProperties = lightminClientProperties; }
Example #7
Source File: LightminEmbeddedConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
@Bean public OnApplicationReadyEventEmbeddedListener onApplicationReadyEventEmbeddedListener( final RegistrationBean registrationBean, final JobRegistry jobRegistry, final LightminClientProperties lightminClientProperties) { return new OnApplicationReadyEventEmbeddedListener(registrationBean, jobRegistry, lightminClientProperties); }
Example #8
Source File: SpringBatchLightminRestConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
@Bean public JobLauncherBean jobLauncherBean( @Qualifier("defaultAsyncJobLauncher") final JobLauncher defaultAsyncJobLauncher, final JobRegistry jobRegistry, final SpringBatchLightminCoreConfigurationProperties properties) { return new JobLauncherBean(defaultAsyncJobLauncher, jobRegistry, properties); }
Example #9
Source File: LightminClientRegistratorService.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
public LightminClientRegistratorService( final LightminClientProperties lightminClientProperties, final LightminClientClassicConfigurationProperties lightminClientClassicConfigurationProperties, final RestTemplate restTemplate, final JobRegistry jobRegistry, final LightminServerLocatorService lightminServerLocatorService) { this.lightminClientProperties = lightminClientProperties; this.lightminClientClassicConfigurationProperties = lightminClientClassicConfigurationProperties; this.restTemplate = restTemplate; this.jobRegistry = jobRegistry; this.lightminServerLocatorService = lightminServerLocatorService; }
Example #10
Source File: SpringBatchLightminServiceConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(value = {JobLauncherBean.class}) public JobLauncherBean jobLauncherBean( @Qualifier("defaultAsyncJobLauncher") final JobLauncher defaultAsyncJobLauncher, final JobRegistry jobRegistry, final SpringBatchLightminCoreConfigurationProperties properties) { return new JobLauncherBean(defaultAsyncJobLauncher, jobRegistry, properties); }
Example #11
Source File: SpringBatchLightminServiceConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(value = {ListenerService.class}) public ListenerService listenerService(final BeanRegistrar beanRegistrar, final JobRegistry jobRegistry, final JobRepository jobRepository) { return new DefaultListenerService(beanRegistrar, jobRegistry, jobRepository); }
Example #12
Source File: SpringBatchLightminServiceConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(value = {SchedulerService.class}) public SchedulerService schedulerService(final BeanRegistrar beanRegistrar, final JobRepository jobRepository, final JobRegistry jobRegistry) { return new DefaultSchedulerService(beanRegistrar, jobRepository, jobRegistry); }
Example #13
Source File: DefaultSchedulerService.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
public DefaultSchedulerService(final BeanRegistrar beanRegistrar, final JobRepository jobRepository, final JobRegistry jobRegistry) { this.beanRegistrar = beanRegistrar; this.jobRepository = jobRepository; this.jobRegistry = jobRegistry; }
Example #14
Source File: JobLauncherBean.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
/** * Lauches a {@link Job} with the given values of the {@link JobLaunch} parameter * * @param jobLaunch the launch information for the Job */ public void launchJob(final JobLaunch jobLaunch) { final Job job; try { job = this.JobRegistry.getJob(jobLaunch.getJobName()); final JobParameters jobParameters = ResourceToDomainMapper.map(jobLaunch.getJobParameters()); final JobExecution jobExecution = this.jobLauncher.run(job, jobParameters); final JobExecutionEvent jobExecutionEvent = new JobExecutionEvent(jobExecution, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); this.applicationEventPublisher.publishEvent(jobExecutionEvent); } catch (final Exception e) { throw new SpringBatchLightminApplicationException(e, e.getMessage()); } }
Example #15
Source File: JobLauncherBean.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
public JobLauncherBean(final JobLauncher jobLauncher, final JobRegistry jobRegistry, final SpringBatchLightminCoreConfigurationProperties properties) { this.jobLauncher = jobLauncher; this.JobRegistry = jobRegistry; this.springBatchLightminCoreConfigurationProperties = properties; }
Example #16
Source File: DefaultJobService.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
public DefaultJobService(final JobOperator jobOperator, final JobRegistry jobRegistry, final JobExplorer jobExplorer, final LightminJobExecutionDao lightminJobExecutionDao) { this.jobOperator = jobOperator; this.jobRegistry = jobRegistry; this.jobExplorer = jobExplorer; this.lightminJobExecutionDao = lightminJobExecutionDao; }
Example #17
Source File: JobCreationListener.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
public JobCreationListener(final ApplicationContext applicationContext, final JobRegistry jobRegistry, final AdminService adminService, final SchedulerService schedulerService, final ListenerService listenerService, final JobExecutionListenerRegisterBean jobExecutionListenerRegisterBean) { this.applicationContext = applicationContext; this.jobRegistry = jobRegistry; this.adminService = adminService; this.schedulerService = schedulerService; this.listenerService = listenerService; this.jobExecutionListenerRegisterBean = jobExecutionListenerRegisterBean; }
Example #18
Source File: JobOperationsController.java From spring-boot-starter-batch-web with Apache License 2.0 | 5 votes |
public JobOperationsController(JobOperator jobOperator, JobExplorer jobExplorer, JobRegistry jobRegistry, JobRepository jobRepository, JobLauncher jobLauncher, JsrJobOperator jsrJobOperator) { super(); this.jobOperator = jobOperator; this.jobExplorer = jobExplorer; this.jobRegistry = jobRegistry; this.jobRepository = jobRepository; this.jobLauncher = jobLauncher; this.jsrJobOperator = jsrJobOperator; }
Example #19
Source File: JobConfigure.java From SpringAll with MIT License | 5 votes |
/** * 注册JobRegistryBeanPostProcessor bean * 用于将任务名称和实际的任务关联起来 */ @Bean public JobRegistryBeanPostProcessor processor(JobRegistry jobRegistry, ApplicationContext applicationContext) { JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor(); postProcessor.setJobRegistry(jobRegistry); postProcessor.setBeanFactory(applicationContext.getAutowireCapableBeanFactory()); return postProcessor; }
Example #20
Source File: AdHocStarter.java From spring-batch-rest with Apache License 2.0 | 5 votes |
public AdHocStarter(JobLocator jobLocator, JobRepository jobRepository, JobPropertyResolvers jobPropertyResolvers, @Value("${com.github.chrisgleissner.springbatchrest.addUniqueJobParameter:true}") boolean addUniqueJobParameter, JobRegistry jobRegistry) { this.jobLocator = jobLocator; asyncJobLauncher = jobLauncher(new SimpleAsyncTaskExecutor(), jobRepository); syncJobLauncher = jobLauncher(new SyncTaskExecutor(), jobRepository); this.jobPropertyResolvers = jobPropertyResolvers; this.addUniqueJobParameter = addUniqueJobParameter; this.jobRegistry = jobRegistry; log.info("Adding unique job parameter: {}", addUniqueJobParameter); }
Example #21
Source File: BaseConfiguration.java From spring-boot-starter-batch-web with Apache License 2.0 | 4 votes |
public JobRegistry jobRegistry() { return jobRegistry; }
Example #22
Source File: LightminClientConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 4 votes |
@Bean public LightminClientApplicationService lightminClientApplicationService( final JobRegistry jobRegistry, final LightminClientProperties lightminClientProperties) { return new LightminClientApplicationService(jobRegistry, lightminClientProperties); }
Example #23
Source File: JobService.java From spring-batch-rest with Apache License 2.0 | 4 votes |
@Autowired public JobService(JobRegistry jobRegistry) { this.jobRegistry = jobRegistry; }
Example #24
Source File: LightminClientApplicationService.java From spring-batch-lightmin with Apache License 2.0 | 4 votes |
public LightminClientApplicationService(final JobRegistry jobRegistry, final LightminClientProperties lightminClientProperties) { this.jobRegistry = jobRegistry; this.lightminClientProperties = lightminClientProperties; }
Example #25
Source File: SpringBatchLightminBatchConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = {JobRegistry.class}) public JobRegistry jobRegistry() { return new MapJobRegistry(); }
Example #26
Source File: SpringBatchLightminRestConfiguration.java From spring-batch-lightmin with Apache License 2.0 | 4 votes |
@Bean public JobConfigurationRestController jobConfigurationRestController(final ServiceEntry serviceEntry, final JobRegistry jobRegistry) { return new JobConfigurationRestController(serviceEntry, jobRegistry); }
Example #27
Source File: JobConfigurationRestController.java From spring-batch-lightmin with Apache License 2.0 | 4 votes |
public JobConfigurationRestController(final ServiceEntry serviceEntry, final JobRegistry jobRegistry) { this.serviceEntry = serviceEntry; this.jobRegistry = jobRegistry; }
Example #28
Source File: DefaultListenerService.java From spring-batch-lightmin with Apache License 2.0 | 4 votes |
public DefaultListenerService(final BeanRegistrar beanRegistrar, final JobRegistry jobRegistry, final JobRepository jobRepository) { this.beanRegistrar = beanRegistrar; this.jobRegistry = jobRegistry; this.jobRepository = jobRepository; }
Example #29
Source File: BatchConfigurer.java From CogStack-Pipeline with Apache License 2.0 | 4 votes |
@Bean public JobRegistry jobRegistry(){ return new MapJobRegistry(); }
Example #30
Source File: BatchJobConfiguration.java From patient-batch-loader with GNU General Public License v3.0 | 4 votes |
@Bean JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor(JobRegistry jobRegistry) { JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor(); postProcessor.setJobRegistry(jobRegistry); return postProcessor; }