user1511848
user1511848

Reputation: 35

Producing messages randomly over partitions

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

Answers (1)

Michael Heil
Michael Heil

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

Related Questions