Reputation: 35
I don't set key while sending messages. Do I have guarantees that messages will go to partititions randomly ? If not how can I achieve this ? I want be sure that my consumers (in one cusumer group) will be evenly loaded.
Upvotes: 0
Views: 1328
Reputation: 18475
Without a key, your Kafka Producer will - by default - apply a RoundRobinPartitioner which will distribute the messages accross the partitions evenly.
If you are looking for a pure "random" Partitioner you could write a custom Partitioner that assigns a partition randomly.
Upvotes: 1