Partitioners used to partition topic partitions.
Partitioners should implement the Partitioner
interface directly to be used with Kafka configurations.
Partitioners used to partition topic partitions. Partitioners should implement the `Partitioner` interface directly to be used with Kafka configurations.
(calculate-partition {:keys [topic key value]}
partitions
key-serializer
value-serializer)
(calculate-partition {:keys [topic key value]}
partitions
key-serializer
value-serializer
partitioner)
(calculate-partition topic
key
value
partitions
key-serializer
value-serializer
partitioner)
Calculates the hypothetical partition for a given topic of n partitions and value to partition, with an optional key.
The calculate partition is dependent on the serializer used and the partitioning algorithm, specificed as a partitioner interface implementor. If no partitioner is provided, the default partitioner is assumed.
This function allows a deterministic way of figuring out which partition your data will go to from a given producer input, even when disconnected from Kafka.
Note that the partition will change for partitioners that depend on some random runtime state. If this is the case, ensure you pass the partitioner itself with any required state inside it so your results are reproducible.
Additionally, some partitioners may not return the same result in the future if the number of partitions increases. Be mindful of the partitioning algorithm.
Most good partitioners should return predictable results, however since the implementation is oopen, there is no guarantee.
Calculates the hypothetical partition for a given topic of n partitions and value to partition, with an optional key. The calculate partition is dependent on the serializer used and the partitioning algorithm, specificed as a partitioner interface implementor. If no partitioner is provided, the default partitioner is assumed. This function allows a deterministic way of figuring out which partition your data will go to from a given producer input, even when disconnected from Kafka. Note that the partition will change for partitioners that depend on some random runtime state. If this is the case, ensure you pass the partitioner itself with any required state inside it so your results are reproducible. Additionally, some partitioners may not return the same result in the future if the number of partitions increases. Be mindful of the partitioning algorithm. Most good partitioners should return predictable results, however since the implementation is oopen, there is no guarantee.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close