Annotation Interface KafkaPartitionKey
@Documented
@Retention(RUNTIME)
@Target(PARAMETER)
@Bindable
@Inherited
public @interface KafkaPartitionKey
Parameter level annotation for Kafka producers to indicate which parameter to compute the Kafka Partition from.
The partition is computed by first serializing the object, using an appropriate serializer from
SerdeRegistry
as determined by, and then computing the partition
number using the same algorithm as Kafka's own DefaultStrategy
(murmur2
)
If the provided value is null
then the configured/default partitioning strategy takes place.
Note that while using KafkaPartitionKey
in the same method as KafkaPartition
will not throw an exception, the outcome of doing so is left unspecified.
- Since:
- 3.3.4
- Author:
- André Prata