@Bean public Step step1(PartitionHandler partitionHandler) throws Exception { return stepBuilderFactory.get("step1") .partitioner(workerStep().getName(), partitioner()) .step(workerStep()) .partitionHandler(partitionHandler) .build(); }
@Bean @Profile("!worker") public Job partitionedJob(PartitionHandler partitionHandler) throws Exception { Random random = new Random(); return jobBuilderFactory.get("partitionedJob"+random.nextInt()) .start(step1(partitionHandler)) .build(); }
@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; }