Example usage for org.springframework.batch.integration.partition BeanFactoryStepLocator BeanFactoryStepLocator

List of usage examples for org.springframework.batch.integration.partition BeanFactoryStepLocator BeanFactoryStepLocator

Introduction

In this page you can find the example usage for org.springframework.batch.integration.partition BeanFactoryStepLocator BeanFactoryStepLocator.

Prototype

BeanFactoryStepLocator

Source Link

Usage

From source file:com.apress.prospringintegration.springbatch.partition.PartitionConfiguration.java

@Bean
public BeanFactoryStepLocator stepLocator() {
    BeanFactoryStepLocator stepLocator = new BeanFactoryStepLocator();
    return stepLocator;
}

From source file:io.spring.batch.configuration.JobConfiguration.java

@Bean
@ServiceActivator(inputChannel = "inboundRequests", outputChannel = "outboundStaging")
public StepExecutionRequestHandler stepExecutionRequestHandler() {
    StepExecutionRequestHandler stepExecutionRequestHandler = new StepExecutionRequestHandler();

    BeanFactoryStepLocator stepLocator = new BeanFactoryStepLocator();
    stepLocator.setBeanFactory(this.applicationContext);
    stepExecutionRequestHandler.setStepLocator(stepLocator);
    stepExecutionRequestHandler.setJobExplorer(this.jobExplorer);

    return stepExecutionRequestHandler;
}

From source file:uk.ac.kcl.batch.JobConfiguration.java

@Bean
public BeanFactoryStepLocator stepLocator() {
    return new BeanFactoryStepLocator();
}

From source file:org.springframework.batch.integration.partition.RemotePartitioningWorkerStepBuilder.java

/**
 * Create an {@link IntegrationFlow} with a {@link StepExecutionRequestHandler}
 * configured as a service activator listening to the input channel and replying
 * on the output channel.//from w w  w. j  a v  a 2  s  . c  o m
 */
private void configureWorkerIntegrationFlow() {
    Assert.notNull(this.inputChannel, "An InputChannel must be provided");
    Assert.notNull(this.jobExplorer, "A JobExplorer must be provided");

    if (this.stepLocator == null) {
        BeanFactoryStepLocator beanFactoryStepLocator = new BeanFactoryStepLocator();
        beanFactoryStepLocator.setBeanFactory(this.beanFactory);
        this.stepLocator = beanFactoryStepLocator;
    }
    if (this.outputChannel == null) {
        if (logger.isDebugEnabled()) {
            logger.debug("The output channel is set to a NullChannel. "
                    + "The master step must poll the job repository for workers status.");
        }
        this.outputChannel = new NullChannel();
    }

    StepExecutionRequestHandler stepExecutionRequestHandler = new StepExecutionRequestHandler();
    stepExecutionRequestHandler.setJobExplorer(this.jobExplorer);
    stepExecutionRequestHandler.setStepLocator(this.stepLocator);

    StandardIntegrationFlow standardIntegrationFlow = IntegrationFlows.from(this.inputChannel)
            .handle(stepExecutionRequestHandler, SERVICE_ACTIVATOR_METHOD_NAME).channel(this.outputChannel)
            .get();
    IntegrationFlowContext integrationFlowContext = this.beanFactory.getBean(IntegrationFlowContext.class);
    integrationFlowContext.registration(standardIntegrationFlow).autoStartup(false).register();
}

From source file:org.springframework.cloud.task.batch.partition.DeployerStepExecutionHandler.java

public DeployerStepExecutionHandler(BeanFactory beanFactory, JobExplorer jobExplorer,
        JobRepository jobRepository) {//from w ww. j ava2  s .  c o m
    Assert.notNull(beanFactory, "A beanFactory is required");
    Assert.notNull(jobExplorer, "A jobExplorer is required");
    Assert.notNull(jobRepository, "A jobRepository is required");

    this.stepLocator = new BeanFactoryStepLocator();
    ((BeanFactoryStepLocator) this.stepLocator).setBeanFactory(beanFactory);

    this.jobExplorer = jobExplorer;
    this.jobRepository = jobRepository;
}