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 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:
      assignPartitions in interface PartitionAssignmentStrategy
      Parameters:
      executionContexts - The list of ExecutionContext instances representing the partitions.
      availableNodes - The list of available node IDs in the cluster.
      Returns:
      A list of PartitionAssignment objects representing the assignment of partitions to nodes.