Class FixedPartitionDistributorBuilder
java.lang.Object
io.camunda.zeebe.broker.partitioning.distribution.FixedPartitionDistributorBuilder
Simplified builder interface to construct a
FixedPartitionDistributor to reduce the risk
of misconfiguration when building a fixed partition distribution.-
Constructor Summary
ConstructorsConstructorDescriptionFixedPartitionDistributorBuilder(String partitionGroupName) Creates a new builder with the specific partition group name. -
Method Summary
Modifier and TypeMethodDescriptionassignMember(int partitionId, int nodeId, int priority) Assigns a member, with a given priority, to the given partition.assignMember(PartitionId partitionId, MemberId memberId, int priority) Assigns a member, with a given priority, to the given partition.build()
-
Constructor Details
-
FixedPartitionDistributorBuilder
Creates a new builder with the specific partition group name. The group name will be used to generatedPartitionIdfrom 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
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 assignednodeId- the ID of the member to assign, e.g. 0, 1, 2priority- 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 assignedmemberId- the ID of the member to assignpriority- the priority of the member- Returns:
- this builder for chaining
-
build
- Returns:
- a distributor configured for a map of partitions to members
-