org.springframework.batch.core.partition.support.Partitioner Java Examples

The following examples show how to use org.springframework.batch.core.partition.support.Partitioner. 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: JobConfiguration.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@Bean
public Partitioner partitioner() {
	return new Partitioner() {
		@Override
		public Map<String, ExecutionContext> partition(int gridSize) {

			Map<String, ExecutionContext> partitions = new HashMap<>(gridSize);

			for (int i = 0; i < GRID_SIZE; i++) {
				ExecutionContext context1 = new ExecutionContext();
				context1.put("partitionNumber", i);

				partitions.put("partition" + i, context1);
			}

			return partitions;
		}
	};
}