Class RoundRobinPartitionAssignmentStrategy
java.lang.Object
io.github.jchejarla.springbatch.clustering.partition.impl.RoundRobinPartitionAssignmentStrategy
- All Implemented Interfaces:
PartitionAssignmentStrategy
public class RoundRobinPartitionAssignmentStrategy
extends Object
implements PartitionAssignmentStrategy
A partition strategy that assigns partitions to nodes in a round-robin fashion.
This strategy iterates through the available nodes, assigning each partition to the next node in the list. It ensures an even distribution of partitions across the nodes.
- Author:
- Janardhan Chejarla
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassignPartitions(List<org.springframework.batch.infrastructure.item.ExecutionContext> executionContexts, List<ClusterNode> availableNodes) Assigns partitions to nodes using a round-robin approach.
-
Constructor Details
-
RoundRobinPartitionAssignmentStrategy
public RoundRobinPartitionAssignmentStrategy()
-
-
Method Details
-
assignPartitions
public List<PartitionAssignment> assignPartitions(List<org.springframework.batch.infrastructure.item.ExecutionContext> executionContexts, List<ClusterNode> availableNodes) Assigns partitions to nodes using a round-robin approach.- Specified by:
assignPartitionsin interfacePartitionAssignmentStrategy- Parameters:
executionContexts- The list ofExecutionContextinstances representing the partitions.availableNodes- The list of available node IDs in the cluster.- Returns:
- A list of
PartitionAssignmentobjects representing the assignment of partitions to nodes.
-