Enum Class PartitionSplitStrategy
- All Implemented Interfaces:
PubSubTopicPartitionSplitStrategy
,Serializable
,Comparable<PartitionSplitStrategy>
,Constable
public enum PartitionSplitStrategy
extends Enum<PartitionSplitStrategy>
implements PubSubTopicPartitionSplitStrategy
Defines the available strategies for splitting a
PubSubTopicPartition
into one or more PubSubPartitionSplit
instances.
Each enum constant encapsulates a specific implementation of
PubSubTopicPartitionSplitStrategy
. This allows the enum itself
to serve as the strategy selector, removing the need for a separate
factory or switch statement.
Usage example:
List<PubSubPartitionSplit> splits =
PartitionSplitStrategy.SINGLE_SPLIT_PER_PARTITION.split(request);
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSplits aPubSubTopicPartition
into multiple splits, with the total number of splits capped at a configured maximum.Splits aPubSubTopicPartition
into multiple splits, each containing a fixed target number of records.Produces exactly one split perPubSubTopicPartition
. -
Method Summary
Modifier and TypeMethodDescriptionsplit
(SplitRequest request) static PartitionSplitStrategy
Returns the enum constant of this class with the specified name.static PartitionSplitStrategy[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
FIXED_RECORD_COUNT
Splits aPubSubTopicPartition
into multiple splits, each containing a fixed target number of records. -
CAPPED_SPLIT_COUNT
Splits aPubSubTopicPartition
into multiple splits, with the total number of splits capped at a configured maximum. The size of each split is calculated by dividing the total record count by this maximum. -
SINGLE_SPLIT_PER_PARTITION
Produces exactly one split perPubSubTopicPartition
. This strategy returns a single continuous range from the start position to the end position without further segmentation.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
split
- Specified by:
split
in interfacePubSubTopicPartitionSplitStrategy
-