Remove usage of master/slave terminology

This commit is contained in:
Mahmoud Ben Hassine
2021-08-17 21:59:30 +02:00
parent 24152e7a57
commit 36b63ed283
33 changed files with 120 additions and 99 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ import org.springframework.batch.item.ExecutionContext;
* caller.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public interface PartitionHandler {
@@ -38,12 +39,12 @@ public interface PartitionHandler {
* Main entry point for {@link PartitionHandler} interface. The splitter
* creates all the executions that need to be farmed out, along with their
* input parameters (in the form of their {@link ExecutionContext}). The
* master step execution is used to identify the partition and group
* manager step execution is used to identify the partition and group
* together the results logically.
*
* @param stepSplitter a strategy for generating a collection of
* {@link StepExecution} instances
* @param stepExecution the master step execution for the whole partition
* @param stepExecution the manager step execution for the whole partition
* @return a collection of completed {@link StepExecution} instances
* @throws Exception if anything goes wrong. This allows implementations to
* be liberal and rely on the caller to translate an exception into a step

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ import org.springframework.batch.core.partition.StepExecutionSplitter;
*
* @author Sebastien Gerard
* @author Dave Syer
* @author Mahmoud Ben Hassine
*/
public abstract class AbstractPartitionHandler implements PartitionHandler {
@@ -40,14 +41,14 @@ public abstract class AbstractPartitionHandler implements PartitionHandler {
* Executes the specified {@link StepExecution} instances and returns an updated
* view of them. Throws an {@link Exception} if anything goes wrong.
*
* @param masterStepExecution the whole partition execution
* @param managerStepExecution the whole partition execution
* @param partitionStepExecutions the {@link StepExecution} instances to execute
* @return an updated view of these completed {@link StepExecution} instances
* @throws Exception if anything goes wrong. This allows implementations to
* be liberal and rely on the caller to translate an exception into a step
* failure as necessary.
*/
protected abstract Set<StepExecution> doHandle(StepExecution masterStepExecution,
protected abstract Set<StepExecution> doHandle(StepExecution managerStepExecution,
Set<StepExecution> partitionStepExecutions) throws Exception;
/**
@@ -55,10 +56,10 @@ public abstract class AbstractPartitionHandler implements PartitionHandler {
*/
@Override
public Collection<StepExecution> handle(final StepExecutionSplitter stepSplitter,
final StepExecution masterStepExecution) throws Exception {
final Set<StepExecution> stepExecutions = stepSplitter.split(masterStepExecution, gridSize);
final StepExecution managerStepExecution) throws Exception {
final Set<StepExecution> stepExecutions = stepSplitter.split(managerStepExecution, gridSize);
return doHandle(masterStepExecution, stepExecutions);
return doHandle(managerStepExecution, stepExecutions);
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import java.util.Collection;
* load using a {@link PartitionHandler}.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class PartitionStep extends AbstractStep {
@@ -87,14 +88,14 @@ public class PartitionStep extends AbstractStep {
/**
* Delegate execution to the {@link PartitionHandler} provided. The
* {@link StepExecution} passed in here becomes the parent or master
* {@link StepExecution} passed in here becomes the parent or manager
* execution for the partition, summarising the status on exit of the
* logical grouping of work carried out by the {@link PartitionHandler}. The
* individual step executions and their input parameters (through
* {@link ExecutionContext}) for the partition elements are provided by the
* {@link StepExecutionSplitter}.
*
* @param stepExecution the master step execution for the partition
* @param stepExecution the manager step execution for the partition
*
* @see Step#execute(StepExecution)
*/

View File

@@ -544,7 +544,7 @@
<xsd:attribute name="aggregator">
<xsd:annotation>
<xsd:documentation><![CDATA[
Reference to a StepExecutionAggregator that will be used to merge the partition results back into the master StepExecution]]>
Reference to a StepExecutionAggregator that will be used to merge the partition results back into the manager StepExecution]]>
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
@ContextConfiguration(locations = "launch-context.xml")
@@ -74,7 +75,7 @@ public class RestartIntegrationTests {
ExampleItemReader.fail = true;
JobParameters jobParameters = new JobParametersBuilder().addString("restart", "yes").toJobParameters();
int beforeMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int beforeManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int beforePartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
ExampleItemWriter.clear();
@@ -88,11 +89,11 @@ public class RestartIntegrationTests {
// Only 4 because the others were processed in the first attempt
assertEquals(4, ExampleItemWriter.getItems().size());
int afterMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int afterManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int afterPartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
// Two attempts
assertEquals(2, afterMaster-beforeMaster);
assertEquals(2, afterManager-beforeManager);
// One failure and two successes
assertEquals(3, afterPartition-beforePartition);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
@ContextConfiguration(locations="launch-context.xml")
@@ -58,12 +59,12 @@ public class VanillaIntegrationTests {
@Test
public void testLaunchJob() throws Exception {
int beforeMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int beforeManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int beforePartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
assertNotNull(jobLauncher.run(job, new JobParameters()));
int afterMaster = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:master'", Integer.class);
int afterManager = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME='step1:manager'", Integer.class);
int afterPartition = jdbcTemplate.queryForObject("SELECT COUNT(*) from BATCH_STEP_EXECUTION where STEP_NAME like 'step1:partition%'", Integer.class);
assertEquals(1, afterMaster-beforeMaster);
assertEquals(1, afterManager-beforeManager);
// Should be same as grid size in step splitter
assertEquals(2, afterPartition-beforePartition);
}

View File

@@ -11,7 +11,7 @@
<bean id="job1" parent="simpleJob">
<property name="steps">
<bean name="step1:master"
<bean name="step1:manager"
class="org.springframework.batch.core.partition.support.PartitionStep">
<property name="partitionHandler">
<bean

View File

@@ -1282,7 +1282,7 @@ Java:
----
You can find a complete example of a remote partitioning job
link:$$https://github.com/spring-projects/spring-batch/tree/master/spring-batch-samples#remote-partitioning-sample$$[here].
link:$$https://github.com/spring-projects/spring-batch/tree/main/spring-batch-samples#remote-partitioning-sample$$[here].
The `@EnableBatchIntegration` annotation that can be used to simplify a remote
partitioning setup. This annotation provides two beans useful for remote partitioning:

View File

@@ -443,7 +443,7 @@ breaking up the record set into views. These views are used by each instance of
application during its processing. The breakup is done by grouping the data.
With this option, each instance of a batch application has to be configured to hit a
particular view (instead of the master table). Also, with the addition of new data
particular view (instead of the main table). Also, with the addition of new data
values, this new group of data has to be included into a view. There is no dynamic
configuration capability, as a change in the number of instances results in a change to
the views.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ import org.springframework.util.ReflectionUtils;
/**
* Convenient factory bean for a chunk handler that also converts an existing chunk-oriented step into a remote chunk
* master. The idea is to lift the existing chunk processor out of a Step that works locally, and replace it with a one
* manager. The idea is to lift the existing chunk processor out of a Step that works locally, and replace it with a one
* that writes chunks into a message channel. The existing step hands its business chunk processing responsibility over
* to the handler produced by the factory, which then needs to be set up as a worker on the other end of the channel the
* chunks are being sent to. Once this chunk handler is installed the application is playing the role of both the manager
@@ -58,7 +58,7 @@ public class RemoteChunkHandlerFactoryBean<T> implements FactoryBean<ChunkHandle
private StepContributionSource stepContributionSource;
/**
* The local step that is to be converted to a remote chunk master.
* The local step that is to be converted to a remote chunk manager.
*
* @param step the step to set
*/
@@ -161,7 +161,7 @@ public class RemoteChunkHandlerFactoryBean<T> implements FactoryBean<ChunkHandle
}
/**
* Replace the chunk processor in the tasklet provided with one that can act as a master in the Remote Chunking
* Replace the chunk processor in the tasklet provided with one that can act as a manager in the Remote Chunking
* pattern.
*
* @param tasklet a ChunkOrientedTasklet

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public class RemoteChunkingWorkerBuilder<I, O> {
private MessageChannel outputChannel;
/**
* Set the {@link ItemProcessor} to use to process items sent by the master
* Set the {@link ItemProcessor} to use to process items sent by the manager
* step.
*
* @param itemProcessor to use
@@ -66,7 +66,7 @@ public class RemoteChunkingWorkerBuilder<I, O> {
}
/**
* Set the {@link ItemWriter} to use to write items sent by the master step.
* Set the {@link ItemWriter} to use to write items sent by the manager step.
*
* @param itemWriter to use
* @return this builder instance for fluent chaining
@@ -78,7 +78,7 @@ public class RemoteChunkingWorkerBuilder<I, O> {
}
/**
* Set the input channel on which items sent by the master are received.
* Set the input channel on which items sent by the manager are received.
*
* @param inputChannel the input channel
* @return this builder instance for fluent chaining
@@ -90,7 +90,7 @@ public class RemoteChunkingWorkerBuilder<I, O> {
}
/**
* Set the output channel on which replies will be sent to the master step.
* Set the output channel on which replies will be sent to the manager step.
*
* @param outputChannel the output channel
* @return this builder instance for fluent chaining

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2009-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.integration.partition;
import java.util.ArrayList;
@@ -209,9 +224,9 @@ public class MessageChannelPartitionHandler implements PartitionHandler, Initial
* @see PartitionHandler#handle(StepExecutionSplitter, StepExecution)
*/
public Collection<StepExecution> handle(StepExecutionSplitter stepExecutionSplitter,
final StepExecution masterStepExecution) throws Exception {
final StepExecution managerStepExecution) throws Exception {
final Set<StepExecution> split = stepExecutionSplitter.split(masterStepExecution, gridSize);
final Set<StepExecution> split = stepExecutionSplitter.split(managerStepExecution, gridSize);
if(CollectionUtils.isEmpty(split)) {
return split;
@@ -232,11 +247,11 @@ public class MessageChannelPartitionHandler implements PartitionHandler, Initial
return receiveReplies(replyChannel);
}
else {
return pollReplies(masterStepExecution, split);
return pollReplies(managerStepExecution, split);
}
}
private Collection<StepExecution> pollReplies(final StepExecution masterStepExecution, final Set<StepExecution> split) throws Exception {
private Collection<StepExecution> pollReplies(final StepExecution managerStepExecution, final Set<StepExecution> split) throws Exception {
final Collection<StepExecution> result = new ArrayList<>(split.size());
Callable<Collection<StepExecution>> callback = new Callable<Collection<StepExecution>>() {
@@ -248,7 +263,7 @@ public class MessageChannelPartitionHandler implements PartitionHandler, Initial
if(!result.contains(curStepExecution)) {
StepExecution partitionStepExecution =
jobExplorer.getStepExecution(masterStepExecution.getJobExecutionId(), curStepExecution.getId());
jobExplorer.getStepExecution(managerStepExecution.getJobExecutionId(), curStepExecution.getId());
if(!partitionStepExecution.getStatus().isRunning()) {
result.add(partitionStepExecution);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,15 +50,15 @@ import org.springframework.util.Assert;
* creates an {@link IntegrationFlow} that:
*
* <ul>
* <li>listens to {@link StepExecutionRequest}s coming from the master
* <li>listens to {@link StepExecutionRequest}s coming from the manager
* on the input channel</li>
* <li>invokes the {@link StepExecutionRequestHandler} to execute the worker
* step for each incoming request. The worker step is located using the provided
* {@link StepLocator}. If no {@link StepLocator} is provided, a {@link BeanFactoryStepLocator}
* configured with the current {@link BeanFactory} will be used
* <li>replies to the master on the output channel (when the master step is
* <li>replies to the manager on the output channel (when the manager step is
* configured to aggregate replies from workers). If no output channel
* is provided, a {@link NullChannel} will be used (assuming the master side
* is provided, a {@link NullChannel} will be used (assuming the manager side
* is configured to poll the job repository for workers status)</li>
* </ul>
*
@@ -85,7 +85,7 @@ public class RemotePartitioningWorkerStepBuilder extends StepBuilder {
}
/**
* Set the input channel on which step execution requests sent by the master
* Set the input channel on which step execution requests sent by the manager
* are received.
* @param inputChannel the input channel
* @return this builder instance for fluent chaining
@@ -97,7 +97,7 @@ public class RemotePartitioningWorkerStepBuilder extends StepBuilder {
}
/**
* Set the output channel on which replies will be sent to the master step.
* Set the output channel on which replies will be sent to the manager step.
* @param outputChannel the input channel
* @return this builder instance for fluent chaining
*/
@@ -235,7 +235,7 @@ public class RemotePartitioningWorkerStepBuilder extends StepBuilder {
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.");
"The manager step must poll the job repository for workers status.");
}
this.outputChannel = new NullChannel();
}

View File

@@ -48,6 +48,7 @@ import static org.mockito.Mockito.when;
*
* @author Will Schipp
* @author Michael Minella
* @author Mahmoud Ben Hassine
*
*/
public class MessageChannelPartitionHandlerTests {
@@ -59,11 +60,11 @@ public class MessageChannelPartitionHandlerTests {
//execute with no default set
messageChannelPartitionHandler = new MessageChannelPartitionHandler();
//mock
StepExecution masterStepExecution = mock(StepExecution.class);
StepExecution managerStepExecution = mock(StepExecution.class);
StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
//execute
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, masterStepExecution);
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, managerStepExecution);
//verify
assertTrue(executions.isEmpty());
}
@@ -74,7 +75,7 @@ public class MessageChannelPartitionHandlerTests {
//execute with no default set
messageChannelPartitionHandler = new MessageChannelPartitionHandler();
//mock
StepExecution masterStepExecution = mock(StepExecution.class);
StepExecution managerStepExecution = mock(StepExecution.class);
StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
MessagingTemplate operations = mock(MessagingTemplate.class);
Message message = mock(Message.class);
@@ -88,7 +89,7 @@ public class MessageChannelPartitionHandlerTests {
messageChannelPartitionHandler.setMessagingOperations(operations);
//execute
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, masterStepExecution);
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, managerStepExecution);
//verify
assertNotNull(executions);
assertTrue(executions.isEmpty());
@@ -100,7 +101,7 @@ public class MessageChannelPartitionHandlerTests {
//execute with no default set
messageChannelPartitionHandler = new MessageChannelPartitionHandler();
//mock
StepExecution masterStepExecution = mock(StepExecution.class);
StepExecution managerStepExecution = mock(StepExecution.class);
StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
MessagingTemplate operations = mock(MessagingTemplate.class);
Message message = mock(Message.class);
@@ -116,7 +117,7 @@ public class MessageChannelPartitionHandlerTests {
messageChannelPartitionHandler.setReplyChannel(replyChannel);
//execute
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, masterStepExecution);
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, managerStepExecution);
//verify
assertNotNull(executions);
assertTrue(executions.isEmpty());
@@ -129,7 +130,7 @@ public class MessageChannelPartitionHandlerTests {
//execute with no default set
messageChannelPartitionHandler = new MessageChannelPartitionHandler();
//mock
StepExecution masterStepExecution = mock(StepExecution.class);
StepExecution managerStepExecution = mock(StepExecution.class);
StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
MessagingTemplate operations = mock(MessagingTemplate.class);
Message message = mock(Message.class);
@@ -142,7 +143,7 @@ public class MessageChannelPartitionHandlerTests {
messageChannelPartitionHandler.setMessagingOperations(operations);
//execute
messageChannelPartitionHandler.handle(stepExecutionSplitter, masterStepExecution);
messageChannelPartitionHandler.handle(stepExecutionSplitter, managerStepExecution);
}
@Test
@@ -151,7 +152,7 @@ public class MessageChannelPartitionHandlerTests {
messageChannelPartitionHandler = new MessageChannelPartitionHandler();
//mock
JobExecution jobExecution = new JobExecution(5L, new JobParameters());
StepExecution masterStepExecution = new StepExecution("step1", jobExecution, 1L);
StepExecution managerStepExecution = new StepExecution("step1", jobExecution, 1L);
StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
MessagingTemplate operations = mock(MessagingTemplate.class);
JobExplorer jobExplorer = mock(JobExplorer.class);
@@ -179,7 +180,7 @@ public class MessageChannelPartitionHandlerTests {
messageChannelPartitionHandler.afterPropertiesSet();
//execute
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, masterStepExecution);
Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, managerStepExecution);
//verify
assertNotNull(executions);
assertEquals(3, executions.size());
@@ -197,7 +198,7 @@ public class MessageChannelPartitionHandlerTests {
messageChannelPartitionHandler = new MessageChannelPartitionHandler();
//mock
JobExecution jobExecution = new JobExecution(5L, new JobParameters());
StepExecution masterStepExecution = new StepExecution("step1", jobExecution, 1L);
StepExecution managerStepExecution = new StepExecution("step1", jobExecution, 1L);
StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
MessagingTemplate operations = mock(MessagingTemplate.class);
JobExplorer jobExplorer = mock(JobExplorer.class);
@@ -223,6 +224,6 @@ public class MessageChannelPartitionHandlerTests {
messageChannelPartitionHandler.afterPropertiesSet();
//execute
messageChannelPartitionHandler.handle(stepExecutionSplitter, masterStepExecution);
messageChannelPartitionHandler.handle(stepExecutionSplitter, managerStepExecution);
}
}

View File

@@ -46,8 +46,8 @@ import static org.springframework.test.util.ReflectionTestUtils.getField;
* @author Mahmoud Ben Hassine
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {RemotePartitioningMasterStepBuilderTests.BatchConfiguration.class})
public class RemotePartitioningMasterStepBuilderTests {
@ContextConfiguration(classes = {RemotePartitioningManagerStepBuilderTests.BatchConfiguration.class})
public class RemotePartitioningManagerStepBuilderTests {
@Autowired
private JobRepository jobRepository;
@@ -151,7 +151,7 @@ public class RemotePartitioningMasterStepBuilderTests {
}
@Test
public void testMasterStepCreationWhenPollingRepository() {
public void testManagerStepCreationWhenPollingRepository() {
// given
int gridSize = 5;
int startLimit = 3;
@@ -162,7 +162,7 @@ public class RemotePartitioningMasterStepBuilderTests {
StepExecutionAggregator stepExecutionAggregator = (result, executions) -> { };
// when
Step step = new RemotePartitioningManagerStepBuilder("masterStep")
Step step = new RemotePartitioningManagerStepBuilder("managerStep")
.repository(jobRepository)
.outputChannel(outputChannel)
.partitioner("workerStep", partitioner)
@@ -196,7 +196,7 @@ public class RemotePartitioningMasterStepBuilderTests {
}
@Test
public void testMasterStepCreationWhenAggregatingReplies() {
public void testManagerStepCreationWhenAggregatingReplies() {
// given
int gridSize = 5;
int startLimit = 3;
@@ -205,7 +205,7 @@ public class RemotePartitioningMasterStepBuilderTests {
StepExecutionAggregator stepExecutionAggregator = (result, executions) -> { };
// when
Step step = new RemotePartitioningManagerStepBuilder("masterStep")
Step step = new RemotePartitioningManagerStepBuilder("managerStep")
.repository(jobRepository)
.outputChannel(outputChannel)
.partitioner("workerStep", partitioner)

View File

@@ -6,7 +6,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-master message-template="messagingTemplate" step="process" reply-channel="replies"/>
<batch-int:remote-chunking-manager message-template="messagingTemplate" step="process" reply-channel="replies"/>
</beans>

View File

@@ -6,7 +6,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-master id="itemWriter" step="process" reply-channel="replies"/>
<batch-int:remote-chunking-manager id="itemWriter" step="process" reply-channel="replies"/>
</beans>

View File

@@ -6,7 +6,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-master id="itemWriter" message-template="messagingTemplate" step="process"/>
<batch-int:remote-chunking-manager id="itemWriter" message-template="messagingTemplate" step="process"/>
</beans>

View File

@@ -6,7 +6,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-master id="itemWriter" message-template="messagingTemplate" reply-channel="replies"/>
<batch-int:remote-chunking-manager id="itemWriter" message-template="messagingTemplate" reply-channel="replies"/>
</beans>

View File

@@ -11,7 +11,7 @@
http://www.springframework.org/schema/batch
https://www.springframework.org/schema/batch/spring-batch.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd">
<batch:job id="processingJob">
@@ -37,7 +37,7 @@
</constructor-arg>
</bean>
<batch-int:remote-chunking-master id="itemWriter" message-template="messagingTemplate" step="process" reply-channel="replies"/>
<batch-int:remote-chunking-manager id="itemWriter" message-template="messagingTemplate" step="process" reply-channel="replies"/>
<bean id="messagingTemplate" class="org.springframework.integration.core.MessagingTemplate"/>

View File

@@ -6,8 +6,8 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-slave input-channel="requests" output-channel="replies"
<batch-int:remote-chunking-worker input-channel="requests" output-channel="replies"
item-processor="itemProcessor" item-writer="itemWriter"/>
</beans>

View File

@@ -6,8 +6,8 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-slave id="remote-chunking-slave" output-channel="replies"
<batch-int:remote-chunking-worker id="remote-chunking-worker" output-channel="replies"
item-processor="itemProcessor" item-writer="itemWriter"/>
</beans>

View File

@@ -6,8 +6,8 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests" output-channel="replies"
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests" output-channel="replies"
item-processor="itemProcessor"/>
</beans>

View File

@@ -6,8 +6,8 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests"
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests"
item-processor="itemProcessor" item-writer="itemWriter"/>
</beans>

View File

@@ -7,9 +7,9 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests" output-channel="replies"
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests" output-channel="replies"
item-writer="itemWriter"/>
<bean id="itemProcessor" class="org.springframework.batch.integration.config.xml.RemoteChunkingParserTests$Processor"/>

View File

@@ -7,9 +7,9 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration-3.1.xsd">
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd">
<batch-int:remote-chunking-slave id="remote-chunking-slave" input-channel="requests" output-channel="replies"
<batch-int:remote-chunking-worker id="remote-chunking-worker" input-channel="requests" output-channel="replies"
item-processor="itemProcessor" item-writer="itemWriter"/>
<bean id="itemProcessor" class="org.springframework.batch.integration.config.xml.RemoteChunkingParserTests$Processor"/>

View File

@@ -54,7 +54,7 @@
</bean>
<job id="job1" xmlns="http://www.springframework.org/schema/batch">
<step id="step1-master">
<step id="step1-manager">
<partition handler="partitionHandler" partitioner="partitioner" />
</step>
</job>

View File

@@ -35,7 +35,7 @@
</bean>
<job id="job1" xmlns="http://www.springframework.org/schema/batch">
<step id="step1-master">
<step id="step1-manager">
<partition handler="partitionHandler" partitioner="partitioner" />
</step>
</job>

View File

@@ -43,7 +43,7 @@
</bean>
<job id="job1" xmlns="http://www.springframework.org/schema/batch">
<step id="step1-master">
<step id="step1-manager">
<partition handler="partitionHandler" partitioner="partitioner" />
</step>
</job>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -102,7 +102,7 @@ public class ManagerConfiguration {
}
/*
* Configure master step components
* Configure manager step components
*/
@Bean
public ListItemReader<Integer> itemReader() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,9 +38,9 @@ import org.springframework.integration.jms.dsl.Jms;
* It uses the {@link RemoteChunkingWorkerBuilder} to configure an
* {@link IntegrationFlow} in order to:
* <ul>
* <li>receive requests from the master</li>
* <li>receive requests from the manager</li>
* <li>process chunks with the configured item processor and writer</li>
* <li>send replies to the master</li>
* <li>send replies to the manager</li>
* </ul>
*
* @author Mahmoud Ben Hassine
@@ -67,7 +67,7 @@ public class WorkerConfiguration {
}
/*
* Configure inbound flow (requests coming from the master)
* Configure inbound flow (requests coming from the manager)
*/
@Bean
public DirectChannel requests() {
@@ -83,7 +83,7 @@ public class WorkerConfiguration {
}
/*
* Configure outbound flow (replies going to the master)
* Configure outbound flow (replies going to the manager)
*/
@Bean
public DirectChannel replies() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ import org.springframework.integration.jms.dsl.Jms;
/**
* This configuration class is for the worker side of the remote partitioning sample.
* Each worker will process a partition sent by the master step.
* Each worker will process a partition sent by the manager step.
*
* @author Mahmoud Ben Hassine
*/
@@ -55,7 +55,7 @@ public class WorkerConfiguration {
}
/*
* Configure inbound flow (requests coming from the master)
* Configure inbound flow (requests coming from the manager)
*/
@Bean
public DirectChannel requests() {

View File

@@ -81,7 +81,7 @@ public abstract class RemotePartitioningJobFunctionalTests {
// then
Assert.assertEquals(ExitStatus.COMPLETED.getExitCode(), jobExecution.getExitStatus().getExitCode());
Assert.assertEquals(4, jobExecution.getStepExecutions().size()); // master + 3 workers
Assert.assertEquals(4, jobExecution.getStepExecutions().size()); // manager + 3 workers
}
@After