Replace "Master/Slave" with "Manager/Worker"
Resolves BATCH-2834
This commit is contained in:
committed by
Michael Minella
parent
3f126fe0ff
commit
3743894fa4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 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.
|
||||
@@ -23,7 +23,7 @@ import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.step.tasklet.TaskletStep;
|
||||
import org.springframework.batch.integration.chunk.RemoteChunkingMasterStepBuilderFactory;
|
||||
import org.springframework.batch.integration.chunk.RemoteChunkingManagerStepBuilderFactory;
|
||||
import org.springframework.batch.integration.config.annotation.EnableBatchIntegration;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -39,8 +39,8 @@ import org.springframework.integration.dsl.IntegrationFlows;
|
||||
import org.springframework.integration.jms.dsl.Jms;
|
||||
|
||||
/**
|
||||
* This configuration class is for the master side of the remote chunking sample.
|
||||
* The master step reads numbers from 1 to 6 and sends 2 chunks {1, 2, 3} and
|
||||
* This configuration class is for the manager side of the remote chunking sample.
|
||||
* The manager step reads numbers from 1 to 6 and sends 2 chunks {1, 2, 3} and
|
||||
* {4, 5, 6} to workers for processing and writing.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
@@ -50,7 +50,7 @@ import org.springframework.integration.jms.dsl.Jms;
|
||||
@EnableBatchIntegration
|
||||
@EnableIntegration
|
||||
@PropertySource("classpath:remote-chunking.properties")
|
||||
public class MasterConfiguration {
|
||||
public class ManagerConfiguration {
|
||||
|
||||
@Value("${broker.url}")
|
||||
private String brokerUrl;
|
||||
@@ -59,7 +59,7 @@ public class MasterConfiguration {
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@Autowired
|
||||
private RemoteChunkingMasterStepBuilderFactory masterStepBuilderFactory;
|
||||
private RemoteChunkingManagerStepBuilderFactory managerStepBuilderFactory;
|
||||
|
||||
@Bean
|
||||
public ActiveMQConnectionFactory connectionFactory() {
|
||||
@@ -110,8 +110,8 @@ public class MasterConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TaskletStep masterStep() {
|
||||
return this.masterStepBuilderFactory.get("masterStep")
|
||||
public TaskletStep managerStep() {
|
||||
return this.managerStepBuilderFactory.get("managerStep")
|
||||
.<Integer, Integer>chunk(3)
|
||||
.reader(itemReader())
|
||||
.outputChannel(requests())
|
||||
@@ -122,7 +122,7 @@ public class MasterConfiguration {
|
||||
@Bean
|
||||
public Job remoteChunkingJob() {
|
||||
return this.jobBuilderFactory.get("remoteChunkingJob")
|
||||
.start(masterStep())
|
||||
.start(managerStep())
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 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.
|
||||
@@ -22,7 +22,7 @@ import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.integration.config.annotation.EnableBatchIntegration;
|
||||
import org.springframework.batch.integration.partition.RemotePartitioningMasterStepBuilderFactory;
|
||||
import org.springframework.batch.integration.partition.RemotePartitioningManagerStepBuilderFactory;
|
||||
import org.springframework.batch.sample.remotepartitioning.BasicPartitioner;
|
||||
import org.springframework.batch.sample.remotepartitioning.BrokerConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.DataSourceConfiguration;
|
||||
@@ -35,8 +35,8 @@ import org.springframework.integration.dsl.IntegrationFlows;
|
||||
import org.springframework.integration.jms.dsl.Jms;
|
||||
|
||||
/**
|
||||
* This configuration class is for the master side of the remote partitioning sample.
|
||||
* The master step will create 3 partitions for workers to process.
|
||||
* This configuration class is for the manager side of the remote partitioning sample.
|
||||
* The manager step will create 3 partitions for workers to process.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@@ -44,20 +44,20 @@ import org.springframework.integration.jms.dsl.Jms;
|
||||
@EnableBatchProcessing
|
||||
@EnableBatchIntegration
|
||||
@Import(value = {DataSourceConfiguration.class, BrokerConfiguration.class})
|
||||
public class MasterConfiguration {
|
||||
public class ManagerConfiguration {
|
||||
|
||||
private static final int GRID_SIZE = 3;
|
||||
|
||||
private final JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
private final RemotePartitioningMasterStepBuilderFactory masterStepBuilderFactory;
|
||||
private final RemotePartitioningManagerStepBuilderFactory managerStepBuilderFactory;
|
||||
|
||||
|
||||
public MasterConfiguration(JobBuilderFactory jobBuilderFactory,
|
||||
RemotePartitioningMasterStepBuilderFactory masterStepBuilderFactory) {
|
||||
public ManagerConfiguration(JobBuilderFactory jobBuilderFactory,
|
||||
RemotePartitioningManagerStepBuilderFactory managerStepBuilderFactory) {
|
||||
|
||||
this.jobBuilderFactory = jobBuilderFactory;
|
||||
this.masterStepBuilderFactory = masterStepBuilderFactory;
|
||||
this.managerStepBuilderFactory = managerStepBuilderFactory;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -93,11 +93,11 @@ public class MasterConfiguration {
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure the master step
|
||||
* Configure the manager step
|
||||
*/
|
||||
@Bean
|
||||
public Step masterStep() {
|
||||
return this.masterStepBuilderFactory.get("masterStep")
|
||||
public Step managerStep() {
|
||||
return this.managerStepBuilderFactory.get("managerStep")
|
||||
.partitioner("workerStep", new BasicPartitioner())
|
||||
.gridSize(GRID_SIZE)
|
||||
.outputChannel(requests())
|
||||
@@ -108,7 +108,7 @@ public class MasterConfiguration {
|
||||
@Bean
|
||||
public Job remotePartitioningJob() {
|
||||
return this.jobBuilderFactory.get("remotePartitioningJob")
|
||||
.start(masterStep())
|
||||
.start(managerStep())
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 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() {
|
||||
@@ -71,7 +71,7 @@ public class WorkerConfiguration {
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure outbound flow (replies going to the master)
|
||||
* Configure outbound flow (replies going to the manager)
|
||||
*/
|
||||
@Bean
|
||||
public DirectChannel replies() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 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.
|
||||
@@ -22,7 +22,7 @@ import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.integration.config.annotation.EnableBatchIntegration;
|
||||
import org.springframework.batch.integration.partition.RemotePartitioningMasterStepBuilderFactory;
|
||||
import org.springframework.batch.integration.partition.RemotePartitioningManagerStepBuilderFactory;
|
||||
import org.springframework.batch.sample.remotepartitioning.BasicPartitioner;
|
||||
import org.springframework.batch.sample.remotepartitioning.BrokerConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.DataSourceConfiguration;
|
||||
@@ -35,8 +35,8 @@ import org.springframework.integration.dsl.IntegrationFlows;
|
||||
import org.springframework.integration.jms.dsl.Jms;
|
||||
|
||||
/**
|
||||
* This configuration class is for the master side of the remote partitioning sample.
|
||||
* The master step will create 3 partitions for workers to process.
|
||||
* This configuration class is for the manager side of the remote partitioning sample.
|
||||
* The manager step will create 3 partitions for workers to process.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@@ -44,20 +44,20 @@ import org.springframework.integration.jms.dsl.Jms;
|
||||
@EnableBatchProcessing
|
||||
@EnableBatchIntegration
|
||||
@Import(value = {DataSourceConfiguration.class, BrokerConfiguration.class})
|
||||
public class MasterConfiguration {
|
||||
public class ManagerConfiguration {
|
||||
|
||||
private static final int GRID_SIZE = 3;
|
||||
|
||||
private final JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
private final RemotePartitioningMasterStepBuilderFactory masterStepBuilderFactory;
|
||||
private final RemotePartitioningManagerStepBuilderFactory managerStepBuilderFactory;
|
||||
|
||||
|
||||
public MasterConfiguration(JobBuilderFactory jobBuilderFactory,
|
||||
RemotePartitioningMasterStepBuilderFactory masterStepBuilderFactory) {
|
||||
public ManagerConfiguration(JobBuilderFactory jobBuilderFactory,
|
||||
RemotePartitioningManagerStepBuilderFactory managerStepBuilderFactory) {
|
||||
|
||||
this.jobBuilderFactory = jobBuilderFactory;
|
||||
this.masterStepBuilderFactory = masterStepBuilderFactory;
|
||||
this.managerStepBuilderFactory = managerStepBuilderFactory;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -77,11 +77,11 @@ public class MasterConfiguration {
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure the master step
|
||||
* Configure the manager step
|
||||
*/
|
||||
@Bean
|
||||
public Step masterStep() {
|
||||
return this.masterStepBuilderFactory.get("masterStep")
|
||||
public Step managerStep() {
|
||||
return this.managerStepBuilderFactory.get("managerStep")
|
||||
.partitioner("workerStep", new BasicPartitioner())
|
||||
.gridSize(GRID_SIZE)
|
||||
.outputChannel(requests())
|
||||
@@ -91,7 +91,7 @@ public class MasterConfiguration {
|
||||
@Bean
|
||||
public Job remotePartitioningJob() {
|
||||
return this.jobBuilderFactory.get("remotePartitioningJob")
|
||||
.start(masterStep())
|
||||
.start(managerStep())
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 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.
|
||||
@@ -25,7 +25,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.sample.config.JobRunnerConfiguration;
|
||||
import org.springframework.batch.sample.remotechunking.MasterConfiguration;
|
||||
import org.springframework.batch.sample.remotechunking.ManagerConfiguration;
|
||||
import org.springframework.batch.sample.remotechunking.WorkerConfiguration;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -36,13 +36,13 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* The master step of the job under test will read data and send chunks to the worker
|
||||
* The manager step of the job under test will read data and send chunks to the worker
|
||||
* (started in {@link RemoteChunkingJobFunctionalTests#setUp()}) for processing and writing.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = {JobRunnerConfiguration.class, MasterConfiguration.class})
|
||||
@ContextConfiguration(classes = {JobRunnerConfiguration.class, ManagerConfiguration.class})
|
||||
@PropertySource("classpath:remote-chunking.properties")
|
||||
public class RemoteChunkingJobFunctionalTests {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class RemoteChunkingJobFunctionalTests {
|
||||
// then
|
||||
Assert.assertEquals(ExitStatus.COMPLETED.getExitCode(), jobExecution.getExitStatus().getExitCode());
|
||||
Assert.assertEquals(
|
||||
"Waited for 2 results.", // the master sent 2 chunks ({1, 2, 3} and {4, 5, 6}) to workers
|
||||
"Waited for 2 results.", // the manager sent 2 chunks ({1, 2, 3} and {4, 5, 6}) to workers
|
||||
jobExecution.getExitStatus().getExitDescription());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 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.
|
||||
@@ -16,17 +16,17 @@
|
||||
package org.springframework.batch.sample;
|
||||
|
||||
import org.springframework.batch.sample.config.JobRunnerConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.aggregating.MasterConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.aggregating.ManagerConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.aggregating.WorkerConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**
|
||||
* The master step of the job under test will create 3 partitions for workers
|
||||
* The manager step of the job under test will create 3 partitions for workers
|
||||
* to process.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@ContextConfiguration(classes = {JobRunnerConfiguration.class, MasterConfiguration.class})
|
||||
@ContextConfiguration(classes = {JobRunnerConfiguration.class, ManagerConfiguration.class})
|
||||
public class RemotePartitioningJobWithMessageAggregationFunctionalTests extends RemotePartitioningJobFunctionalTests {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2019 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.
|
||||
@@ -16,17 +16,17 @@
|
||||
package org.springframework.batch.sample;
|
||||
|
||||
import org.springframework.batch.sample.config.JobRunnerConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.polling.MasterConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.polling.ManagerConfiguration;
|
||||
import org.springframework.batch.sample.remotepartitioning.polling.WorkerConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**
|
||||
* The master step of the job under test will create 3 partitions for workers
|
||||
* The manager step of the job under test will create 3 partitions for workers
|
||||
* to process.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@ContextConfiguration(classes = {JobRunnerConfiguration.class, MasterConfiguration.class})
|
||||
@ContextConfiguration(classes = {JobRunnerConfiguration.class, ManagerConfiguration.class})
|
||||
public class RemotePartitioningJobWithRepositoryPollingFunctionalTests extends RemotePartitioningJobFunctionalTests {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user