org.springframework.batch.core.partition.PartitionHandler Java Examples

The following examples show how to use org.springframework.batch.core.partition.PartitionHandler. 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: RemoteConfiguration.java    From CogStack-Pipeline with Apache License 2.0 7 votes vote down vote up
@Bean
public Job job(JobBuilderFactory jobs,
               StepBuilderFactory steps,
               Partitioner partitioner,
               @Qualifier("partitionHandler") PartitionHandler partitionHandler,
               JobCompleteNotificationListener jobCompleteNotificationListener,
               @Qualifier("tLJobParametersIncrementer") TLJobParametersIncrementer runIdIncrementer

               ) {
    return jobs.get(jobName)
            .incrementer(runIdIncrementer)
            .listener(jobCompleteNotificationListener)
            .flow(
                    steps
                            .get(jobName + "MasterStep")
                            .partitioner((jobName+"SlaveStep"), partitioner)
                            .partitionHandler(partitionHandler)
                            .build()
            )
            .end()
            .build();

}
 
Example #2
Source File: LocalConfiguration.java    From CogStack-Pipeline with Apache License 2.0 6 votes vote down vote up
@Bean
public Job job(JobBuilderFactory jobs,
               StepBuilderFactory steps,
               Partitioner partitioner,
               JobCompleteNotificationListener jobCompleteNotificationListener,
               @Qualifier("partitionHandler") PartitionHandler partitionHandler,
               @Qualifier("tLJobParametersIncrementer") TLJobParametersIncrementer runIdIncrementer

) {
    return jobs.get(env.getProperty("job.jobName"))
            .incrementer(runIdIncrementer)
            .listener(jobCompleteNotificationListener)
            .flow(
                    steps
                            .get(jobName + "MasterStep")
                            .partitioner((jobName+"SlaveStep"), partitioner)
                            .partitionHandler(partitionHandler)
                            .build()
            )
            .end()
            .build();

}
 
Example #3
Source File: EmployeeJobConfigMaster.java    From batchers with Apache License 2.0 6 votes vote down vote up
@Bean
@StepScope
public PartitionHandler taxCalculationPartitionHandler() {
    MessageChannelPartitionHandler messageChannelPartitionHandler = new MessageChannelPartitionHandler();
    messageChannelPartitionHandler.setGridSize(clusterConfig.getClusterSize() - MASTER_WITHOUT_TAX_CALCULATION_STEP);
    messageChannelPartitionHandler.setReplyChannel(replyChannel());
    messageChannelPartitionHandler.setStepName(EmployeeJobConfigSlave.TAX_CALCULATION_STEP);

    MessagingTemplate messagingGateway = new MessagingTemplate();
    messagingGateway.setReceiveTimeout(RECEIVE_TIMEOUT);
    messagingGateway.setDefaultChannel(outboundRequests());
    messageChannelPartitionHandler.setMessagingOperations(messagingGateway);

    return messageChannelPartitionHandler;
}
 
Example #4
Source File: JdbcHdfsConfiguration.java    From spring-cloud-task-app-starters with Apache License 2.0 5 votes vote down vote up
@Bean
@Profile("!worker")
public Job partitionedJob(PartitionHandler partitionHandler, ExecutionContextPromotionListener promotionListener,
		 IncrementalColumnRangePartitioner partitioner) throws Exception {
	String jobName = environment.getProperty("spring.cloud.task.name") != null ?
			environment.getProperty("spring.cloud.task.name"): this.context.getId();
	JobBuilder jobBuilder =  this.jobBuilderFactory.get(jobName);
	if(!this.props.isRestartable()) {
		jobBuilder.preventRestart();
	}
	return jobBuilder.start(step1(partitionHandler, promotionListener, partitioner))
			.build();
}
 
Example #5
Source File: JobConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Bean
public Step step1(PartitionHandler partitionHandler) throws Exception {
	return this.stepBuilderFactory.get("step1")
		.partitioner(workerStep().getName(), partitioner())
		.step(workerStep())
		.partitionHandler(partitionHandler)
		.build();
}
 
Example #6
Source File: JobConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Bean
@Profile("!worker")
public Job partitionedJob(PartitionHandler partitionHandler) throws Exception {
	Random random = new Random();
	return this.jobBuilderFactory.get("partitionedJob" + random.nextInt())
		.start(step1(partitionHandler))
		.build();
}