@Test public void stepExecutionRequestShouldBeSerializableWithJackson() throws IOException { // given StepExecutionRequest request = new StepExecutionRequest("step", 1L, 1L); // when String serializedRequest = this.objectMapper.writeValueAsString(request); // then Assert.assertEquals(SERIALIZED_REQUEST, serializedRequest); }
/** * Sends {@link StepExecutionRequest} objects to the request channel of the {@link MessagingTemplate}, and then * receives the result back as a list of {@link StepExecution} on a reply channel. Use the {@link #aggregate(List)} * method as an aggregator of the individual remote replies. The receive timeout needs to be set realistically in * the {@link MessagingTemplate} <b>and</b> the aggregator, so that there is a good chance of all work being done. * * @see PartitionHandler#handle(StepExecutionSplitter, StepExecution) */ public Collection<StepExecution> handle(StepExecutionSplitter stepExecutionSplitter, final StepExecution masterStepExecution) throws Exception { final Set<StepExecution> split = stepExecutionSplitter.split(masterStepExecution, gridSize); if(CollectionUtils.isEmpty(split)) { return split; } int count = 0; for (StepExecution stepExecution : split) { Message<StepExecutionRequest> request = createMessage(count++, split.size(), new StepExecutionRequest( stepName, stepExecution.getJobExecutionId(), stepExecution.getId()), replyChannel); if (logger.isDebugEnabled()) { logger.debug("Sending request: " + request); } messagingGateway.send(request); } if(!pollRepositoryForResults) { return receiveReplies(replyChannel); } else { return pollReplies(masterStepExecution, split); } }