Example usage for org.springframework.batch.integration.partition StepExecutionRequestHandler setJobExplorer

List of usage examples for org.springframework.batch.integration.partition StepExecutionRequestHandler setJobExplorer

Introduction

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

Prototype

public void setJobExplorer(JobExplorer jobExplorer) 

Source Link

Document

An explorer that should be used to check for StepExecution completion.

Usage

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

@Bean
public StepExecutionRequestHandler stepExecutionRequestHandler() throws Exception {
    StepExecutionRequestHandler stepExecutionRequestHandler = new StepExecutionRequestHandler();
    stepExecutionRequestHandler.setJobExplorer((JobExplorer) jobExplorer().getObject());
    stepExecutionRequestHandler.setStepLocator(stepLocator());
    return stepExecutionRequestHandler;
}

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

@Bean
public StepExecutionRequestHandler stepExecutionRequestHandler(JobExplorer jobExplorer,
        BeanFactoryStepLocator stepLocator) {
    StepExecutionRequestHandler handler = new StepExecutionRequestHandler();
    handler.setJobExplorer(jobExplorer);
    handler.setStepLocator(stepLocator);
    return handler;
}

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: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  va2s . co 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();
}