Class FixedPartitionDistributorBuilder

java.lang.Object
io.camunda.zeebe.broker.partitioning.distribution.FixedPartitionDistributorBuilder

public final class FixedPartitionDistributorBuilder extends Object
Simplified builder interface to construct a FixedPartitionDistributor to reduce the risk of misconfiguration when building a fixed partition distribution.
  • Constructor Details

    • FixedPartitionDistributorBuilder

      public FixedPartitionDistributorBuilder(String partitionGroupName)
      Creates a new builder with the specific partition group name. The group name will be used to generated PartitionId from raw integers. This effectively scopes the distributor to a given partition group - you should not use the distributor with a different partition group.
      Parameters:
      partitionGroupName - the name of the partition group for which the distributor is built
  • Method Details

    • assignMember

      public FixedPartitionDistributorBuilder assignMember(int partitionId, int nodeId, int priority)
      Assigns a member, with a given priority, to the given partition. Members assigned to a partition will take part in the Raft for that partition.

      NOTE: this method is a convenience method which will convert the raw IDs into strongly typed identifiers. See assignMember(PartitionId, MemberId, int) for more.

      Parameters:
      partitionId - the ID of the partition to which the member should be assigned
      nodeId - the ID of the member to assign, e.g. 0, 1, 2
      priority - the priority of the member
      Returns:
      this builder for chaining
    • assignMember

      public FixedPartitionDistributorBuilder assignMember(PartitionId partitionId, MemberId memberId, int priority)
      Assigns a member, with a given priority, to the given partition. Members assigned to a partition will take part in the Raft for that partition.

      There is no validation applied to the IDs, as there is no intrinsically "wrong" ID. However passing the wrong ID may cause failures later on when attempting to use the distributor.

      Parameters:
      partitionId - the ID of the partition to which the member should be assigned
      memberId - the ID of the member to assign
      priority - the priority of the member
      Returns:
      this builder for chaining
    • build

      public FixedPartitionDistributor build()
      Returns:
      a distributor configured for a map of partitions to members