Class RandomBrokerPartitionSubsetPartitioner
java.lang.Object
io.confluent.telemetry.events.exporter.kafka.RandomBrokerPartitionSubsetPartitioner
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.kafka.clients.producer.Partitioner,org.apache.kafka.common.Configurable
public class RandomBrokerPartitionSubsetPartitioner
extends Object
implements org.apache.kafka.clients.producer.Partitioner
A partitioner that reduces the number of connections a producer needs to make by
- Specifying a subset percentage of total partitions to produce to
- Randomly connecting to brokers and taking all partitions on that broker until it has connected to the subset of partitions
- Randomly produce to the recorded partitions
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidintpartition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, org.apache.kafka.common.Cluster cluster) Choose the partition for a record from partitions found on a limited number of brokers according to `subset.partitioner.partition.percentage`.
-
Field Details
-
SUBSET_PARTITIONER_PARTITION_PERCENTAGE_CONFIG
- See Also:
-
DEFAULT_SUBSET_PARTITIONER_PARTITION_PERCENTAGE
public static final double DEFAULT_SUBSET_PARTITIONER_PARTITION_PERCENTAGE- See Also:
-
SUBSET_PARTITIONER_RECALCULATION_BACKOFF_CONFIG
- See Also:
-
-
Constructor Details
-
RandomBrokerPartitionSubsetPartitioner
public RandomBrokerPartitionSubsetPartitioner()
-
-
Method Details
-
partition
public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, org.apache.kafka.common.Cluster cluster) Choose the partition for a record from partitions found on a limited number of brokers according to `subset.partitioner.partition.percentage`. NOTE: this partitioner will not respect the record key when choosing a partition for the record.- Specified by:
partitionin interfaceorg.apache.kafka.clients.producer.Partitioner
-
configure
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.apache.kafka.clients.producer.Partitioner
-