zilcuanu
zilcuanu

Reputation: 3715

Custom partition of kafka topics using Spring Boot

Is there a way to create partition key based on hash calculated on an attribute of payload using Spring Boot. There is an interface called Partition in apache-kafka, but not sure how to allocate the messages into different partitions using Spring boot.

Upvotes: 1

Views: 1756

Answers (1)

Gary Russell
Gary Russell

Reputation: 174564

See the kafka documentation.

Set the partitioner.class producer property to your class name.

partitioner.class

Partitioner class that implements the org.apache.kafka.clients.producer.Partitioner interface.

default:org.apache.kafka.clients.producer.internals.DefaultPartitioner

Upvotes: 3

Related Questions