Java 类org.springframework.batch.core.configuration.annotation.StepBuilderFactory 实例源码

项目:building-microservices    文件:BatchConfiguration.java   
@Bean
Job personEtl(JobBuilderFactory jobBuilderFactory,
        StepBuilderFactory stepBuilderFactory,
        FlatFileItemReader<Person> reader,
        JdbcBatchItemWriter<Person> writer
) {

    Step step = stepBuilderFactory.get("file-to-database")
            .<Person, Person>chunk(5)
            .reader(reader)
            .writer(writer)
            .build();

    return jobBuilderFactory.get("etl")
            .start(step)
            .build();
}
项目:spring-batch    文件:BatchConfiguration.java   
@Bean
public Step importTicketStep(final StepBuilderFactory stepBuilderFactory,
                             @Qualifier("jpaTransactionManagerForBatch")
                             final PlatformTransactionManager jpaTransactionManager,
                             final @Value("${ticket.chunk.size}") int chunkSize,
                             final ItemReader<Ticket> ticketReader,
                             final ItemWriter<Ticket> ticketWriter,
                             final ItemProcessor<Ticket, Ticket> importTicketProcessor) {
    return stepBuilderFactory.get("importTicketStep")
            .<Ticket, Ticket>chunk(chunkSize)
            .reader(ticketReader)
            .processor(importTicketProcessor)
            .writer(ticketWriter)
            .transactionManager(jpaTransactionManager)
            .build();
}
项目:nixmash-blog    文件:DemoJobConfiguration.java   
@Autowired
public DemoJobConfiguration(EntityManagerFactory entityManagerFactory, DemoJobListener demoJobListener, DemoJobStepListener demoJobStepListener, StepBuilderFactory stepBuilderFactory, JobBuilderFactory jobBuilderFactory) {
    this.entityManagerFactory = entityManagerFactory;
    this.demoJobListener = demoJobListener;
    this.demoJobStepListener = demoJobStepListener;
    this.stepBuilderFactory = stepBuilderFactory;
    this.jobBuilderFactory = jobBuilderFactory;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JobLauncherCommandLineRunnerTests.java   
@Before
public void init() throws Exception {
    this.context.register(BatchConfiguration.class);
    this.context.refresh();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    this.jobLauncher = this.context.getBean(JobLauncher.class);
    this.jobs = new JobBuilderFactory(jobRepository);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    this.steps = new StepBuilderFactory(jobRepository, transactionManager);
    this.step = this.steps.get("step").tasklet(new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution,
                ChunkContext chunkContext) throws Exception {
            return null;
        }
    }).build();
    this.job = this.jobs.get("job").start(this.step).build();
    this.jobExplorer = this.context.getBean(JobExplorer.class);
    this.runner = new JobLauncherCommandLineRunner(this.jobLauncher,
            this.jobExplorer);
    this.context.getBean(BatchConfiguration.class).clear();
}
项目:spring-boot-concourse    文件:JobLauncherCommandLineRunnerTests.java   
@Before
public void init() throws Exception {
    this.context.register(BatchConfiguration.class);
    this.context.refresh();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    this.jobLauncher = this.context.getBean(JobLauncher.class);
    this.jobs = new JobBuilderFactory(jobRepository);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    this.steps = new StepBuilderFactory(jobRepository, transactionManager);
    this.step = this.steps.get("step").tasklet(new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution,
                ChunkContext chunkContext) throws Exception {
            return null;
        }
    }).build();
    this.job = this.jobs.get("job").start(this.step).build();
    this.jobExplorer = this.context.getBean(JobExplorer.class);
    this.runner = new JobLauncherCommandLineRunner(this.jobLauncher,
            this.jobExplorer);
    this.context.getBean(BatchConfiguration.class).clear();
}
项目:marklogic-spring-batch    文件:ImportRdfFromFileJob.java   
@Bean
@JobScope
public Step step1(
        StepBuilderFactory stepBuilderFactory,
        DatabaseClientProvider databaseClientProvider,
        @Value("#{jobParameters['input_file_path']}") String inputFilePath,
        @Value("#{jobParameters['graph_name']}") String graphName) {
    RdfTripleItemReader<Map<String, Object>> reader = new RdfTripleItemReader<Map<String, Object>>();
    reader.setFileName(inputFilePath);

    RdfTripleItemWriter writer = new RdfTripleItemWriter(databaseClientProvider.getDatabaseClient(), graphName);

    return stepBuilderFactory.get("step1")
            .<Map<String, Object>, Map<String, Object>>chunk(10)
            .reader(reader)
            .writer(writer)
            .build();
}
项目:javaconfig-ftw    文件:BatchConfiguration.java   
@Bean(name = readCsvFileIntoTableStep)
public Step readCsvFileIntoTableStep(
        StepBuilderFactory stepBuilderFactory,
        PlatformTransactionManager platformTransactionManager,
        @Qualifier(readCsvFileIntoTableStepReader) ItemReader<Customer> ir,
        @Qualifier(readCsvFileIntoTableStepProcessor) ItemProcessor<Customer, Customer> itemProcessor,
        @Qualifier(readCsvFileIntoTableStepWriter) ItemWriter<Customer> iw) {

    StepBuilder builder = stepBuilderFactory.get(readCsvFileIntoTableStep);

    return builder.<Customer, Customer>chunk(3)
            .reader(ir)
            .processor(itemProcessor)
            .writer(iw)
            .transactionManager(platformTransactionManager)
            .build();
}
项目:Spring-5.0-Cookbook    文件:BatchConfig.java   
@Bean("step1")
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Employee> reader,
                     ItemProcessor<Employee, Permanent> processor) {
      return stepBuilderFactory.get("step1")
              .<Employee, Permanent>chunk(5)
              .reader(reader)
              .processor(processor)
              .writer(writer())
              .build();
}
项目:Spring-5.0-Cookbook    文件:BatchConfig.java   
@Bean("step2")
public Step step2(StepBuilderFactory stepBuilderFactory, ItemReader<Employee> reader,
                   ItemProcessor<Employee, Permanent> processor) {
      return stepBuilderFactory.get("step2")
              .<Employee, Permanent>chunk(2)
              .reader(reader)
              .processor(processor)
              .writer(xmlWriter())
              .build();
}
项目:hub-fortify-ssc-integration-service    文件:BlackDuckFortifyPhoneHomeJobConfig.java   
@Autowired
public BlackDuckFortifyPhoneHomeJobConfig(JobLauncher jobLauncher, JobBuilderFactory jobBuilderFactory,
        StepBuilderFactory stepBuilderFactory, HubServices hubServices, PropertyConstants propertyConstants) {
    this.jobLauncher = jobLauncher;
    this.jobBuilderFactory = jobBuilderFactory;
    this.stepBuilderFactory = stepBuilderFactory;
    this.hubServices = hubServices;
    this.propertyConstants = propertyConstants;
}
项目:TaskMadness    文件:MooreStatConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<MooreNcaaStat> reader,
                  ItemWriter<MooreNcaaStat> writer) {
    return stepBuilderFactory.get("step1")
            .<MooreNcaaStat, MooreNcaaStat>chunk(10)
            .reader(reader)
            .writer(writer)
            .build();
}
项目:TaskMadness    文件:NcaaStatConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory,
                  ItemReader<NcaaStats> reader,
                  ItemWriter<NcaaStats> writer,
                  ItemProcessor<NcaaStats,NcaaStats> processor) {
    return stepBuilderFactory.get("step1")
            .<NcaaStats, NcaaStats>chunk(10)
            .reader(reader)
            .processor(processor)
            .writer(writer)
            .build();
}
项目:contestparser    文件:JobLauncherCommandLineRunnerTests.java   
@Before
public void init() throws Exception {
    this.context.register(BatchConfiguration.class);
    this.context.refresh();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    this.jobLauncher = this.context.getBean(JobLauncher.class);
    this.jobs = new JobBuilderFactory(jobRepository);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    this.steps = new StepBuilderFactory(jobRepository, transactionManager);
    this.step = this.steps.get("step").tasklet(new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution,
                ChunkContext chunkContext) throws Exception {
            return null;
        }
    }).build();
    this.job = this.jobs.get("job").start(this.step).build();
    this.jobExplorer = this.context.getBean(JobExplorer.class);
    this.runner = new JobLauncherCommandLineRunner(this.jobLauncher,
            this.jobExplorer);
    this.context.getBean(BatchConfiguration.class).clear();
}
项目:json-file-itemwriter    文件:BatchConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Person> reader,
        ItemWriter<Person> writer, ItemProcessor<Person, Person> processor) {

    return stepBuilderFactory.get("step1")
            .<Person, Person> chunk(2) //commit-interval = 2
            .reader(reader)
            .processor(processor)
            .writer(writer)
            .build();
}
项目:json-file-itemwriter    文件:BatchConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Person> reader,
        ItemWriter<Person> writer, ItemProcessor<Person, Person> processor) {

    return stepBuilderFactory.get("step1")
            .<Person, Person> chunk(2) //commit-interval = 2
            .reader(reader)
            .processor(processor)
            .writer(writer)
            .build();
}
项目:json-file-itemwriter    文件:BatchConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Person> reader,
        ItemWriter<Person> writer, ItemProcessor<Person, Person> processor) {

    return stepBuilderFactory.get("step1")
            .<Person, Person> chunk(2) //commit-interval = 2
            .reader(reader)
            .processor(processor)
            .writer(writer)
            .build();
}
项目:GemFireLite    文件:BatchConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Person> reader, ItemWriter<Person> writer,
    ItemProcessor<Person, Person> processor)
{
  return stepBuilderFactory.get("step1").<Person, Person> chunk(10).reader(reader).processor(processor)
      .writer(writer).build();
}
项目:jplantuml    文件:PlantUmlConfig.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Path> reader,
    ItemWriter<NamedBytes> writer, ItemProcessor<Path, NamedBytes> processor) {
    return stepBuilderFactory.get("step1")
        .<Path, NamedBytes>chunk(5)
        .reader(reader)
        .processor(processor)
        .writer(writer)
        .build();
}
项目:WebAPI    文件:JobConfig.java   
@Bean
public JobTemplate jobTemplate(final JobLauncher jobLauncher, final JobBuilderFactory jobBuilders,
                               final StepBuilderFactory stepBuilders) {
    return new JobTemplate(jobLauncher, jobBuilders, stepBuilders);
}
项目:spring-batch-scheduler-example    文件:BatchConfiguration.java   
/**
 * Step
 * We declare that every 1000 lines processed the data has to be committed
 *
 * @param stepBuilderFactory
 * @param reader
 * @param writer
 * @param processor
 * @return
 */

@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Account> reader,
                  ItemWriter<Person> writer, ItemProcessor<Account, Person> processor) {
    return stepBuilderFactory.get("step1")
            .<Account, Person>chunk(1000)
            .reader(reader)
            .processor(processor)
            .writer(writer)
            .build();
}
项目:kickoff-spring-batch    文件:BatchConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory,
        ItemReader<Person> reader, ItemWriter<Person> writer,
        ItemProcessor<Person, Person> processor) {
    return stepBuilderFactory.get("step1").<Person, Person> chunk(10)
            .reader(reader).processor(processor).writer(writer).build();
}
项目:composed-task-runner    文件:ComposedTaskRunnerStepFactoryTests.java   
@Bean
public StepBuilderFactory steps(){
    return new StepBuilderFactory(mock(JobRepository.class), mock(PlatformTransactionManager.class));
}
项目:nixmash-blog    文件:GithubJobConfiguration.java   
public GithubJobConfiguration(JobBuilderFactory jobBuilderFactory, StepBuilderFactory stepBuilderFactory, GithubJobListener githubJobListener, GithubJobUI githubJobUI) {
    this.jobBuilderFactory = jobBuilderFactory;
    this.stepBuilderFactory = stepBuilderFactory;
    this.githubJobListener = githubJobListener;
    this.githubJobUI = githubJobUI;
}
项目:spring-batch-support    文件:SpringBatchDefaultServiceConfiguration.java   
@Bean
@ConditionalOnMissingBean(StepBuilderFactory.class)
public StepBuilderFactory stepBuilderFactory(JobRepository jobRepository) throws Exception {
    return new StepBuilderFactory(
            jobRepository, transactionManager);
}
项目:spring-seed    文件:SpringSeedBatchConfig.java   
@Bean
public StepBuilderFactory stepBuilderFactory() throws Exception {
    return new StepBuilderFactory(jobRepository().getObject(), batchTransactionManager());
}
项目:oma-riista-web    文件:BatchConfig.java   
@Bean
public StepBuilderFactory stepBuilders() throws Exception {
    return new StepBuilderFactory(jobRepository(), transactionManager);
}
项目:springboot-batch-doma    文件:BatchConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Account> reader, ItemWriter<Person> writer,
        ItemProcessor<Account, Person> processor) {
    return stepBuilderFactory.get("step1").<Account, Person> chunk(10).reader(reader).processor(processor)
            .writer(writer).build();
}
项目:spring-playground    文件:Step1.java   
public Step1(StepBuilderFactory stepBuilderFactory, DataSource dataSource) {
    this.stepBuilderFactory = stepBuilderFactory;
    this.dataSource = dataSource;
}
项目:springBatchJmsKata    文件:SimpleStringProcessingJob.java   
@Bean
public Step stepProcess(StepBuilderFactory stepBuilderFactory, ItemReader<String> reader, ItemWriter<String> writer, ItemProcessor<String, String> processor) {
    return stepBuilderFactory.get("stringStep").<String, String> chunk(3).reader(reader).processor(processor).writer(writer).build();
}
项目:building-microservices    文件:ContactBatchJobConfiguration.java   
@Bean
public Step step1(StepBuilderFactory stepBuilderFactory, ItemReader<Contact> reader,
        ItemWriter<Contact> writer, ItemProcessor<Contact, Contact> processor) {
    return stepBuilderFactory.get("step1").<Contact, Contact>chunk(10).reader(reader)
            .processor(processor).writer(writer).build();
}
项目:marklogic-spring-batch    文件:YourTwoStepJobConfig.java   
@Bean
@JobScope
public Step step2(StepBuilderFactory stepBuilderFactory) {
    ItemReader<String> reader = new ItemReader<String>() {
        int i = 0;

        @Override
        public String read() throws Exception {
            i++;
            return i == 1 ? "hello" : null;
        }
    };


    ItemWriter<String> writer = new ItemWriter<String>() {
        String someString;

        @BeforeStep
        public void beforeStep(StepExecution stepExecution) {
            JobExecution jobExecution = stepExecution.getJobExecution();
            ExecutionContext jobContext = jobExecution.getExecutionContext();
            this.someString = jobContext.getString("someKey");
        }

        @Override
        public void write(List<? extends String> items) throws Exception {
            logger.info("Step 2: " + someString);
            for (String item : items) {
                logger.info("step2: " + item);
            }
        }

    };


    return stepBuilderFactory.get("step2")
            .<String, String>chunk(10)
            .reader(reader)
            .writer(writer)
            .listener(writer)
            .build();
}
项目:springone-2015    文件:SparkYarnConfiguration.java   
@Bean
  Step initScript(StepBuilderFactory steps, Tasklet scriptTasklet) throws Exception {
return steps.get("initScript")
        .tasklet(scriptTasklet)
          .build();
  }
项目:springone-2015    文件:SparkYarnConfiguration.java   
@Bean
  Step sparkTopHashtags(StepBuilderFactory steps, Tasklet sparkTopHashtagsTasklet) throws Exception {
return steps.get("sparkTopHashtags")
        .tasklet(sparkTopHashtagsTasklet)
          .build();
  }
项目:WebAPI    文件:JobTemplate.java   
public JobTemplate(final JobLauncher jobLauncher, final JobBuilderFactory jobBuilders,
    final StepBuilderFactory stepBuilders) {
    this.jobLauncher = jobLauncher;
    this.jobBuilders = jobBuilders;
    this.stepBuilders = stepBuilders;
}
项目:working-examples    文件:BatchImporterConfiguration.java   
@Bean
public StepBuilderFactory stepBuilderFactory() {

    return new StepBuilderFactory(jobRepository, transactionManager);
}
项目:spring4-sandbox    文件:JpaBatchConfigurer.java   
@Bean   
public StepBuilderFactory stepBuilderFactory(JobRepository jobRepository, PlatformTransactionManager transactionManager){
    return new StepBuilderFactory(jobRepository, transactionManager);
}
项目:spring-batch-experiments    文件:LaunchConfiguration.java   
@Bean
public StepBuilderFactory stepBuilderFactory() throws Exception {
    return new StepBuilderFactory(jobRepository(), transactionManager());
}
项目:spring-batch-experiments    文件:BatchInfrastructureConfiguration.java   
@Bean
public StepBuilderFactory stepBuilderFactory(
        JobRepository jobRepository,
        @Qualifier("jobTransactionManager") PlatformTransactionManager transactionManager) throws Exception {
    return new StepBuilderFactory(jobRepository, transactionManager);
}
项目:spring-batch-experiments    文件:LaunchConfiguration.java   
@Bean
public StepBuilderFactory stepBuilderFactory(JobRepository jobRepository,
                                             PlatformTransactionManager transactionManager) throws Exception {
    return new StepBuilderFactory(jobRepository, transactionManager);
}
项目:spring-batch-experiments    文件:LaunchConfiguration.java   
@Bean
public StepBuilderFactory stepBuilderFactory() throws Exception {
    return new StepBuilderFactory(jobRepository(), transactionManager());
}