Skip to content

Tag: kafka-producer-api

How to read headers in kafka partitioner

I’d like to extend Kafka DefaultPartitioner to make a custom one. However, I find no way to access the message headers as the partitioning should be based on a value present there. EDIT 1: The task is choosing a partition not based on the key but on another integer contained in the header. Answer You cannot access headers in custom

kafka producer does not throw exception when broker is down

Created a cluster with two brokers using same zookeeper and trying to produce message to a topic whose details are as below. When the producer sets acks=”all” or -1,min.insync.replicas=”2″, it is supposed to receive acknowledgement from the brokers(leaders and replicas) but when one broker is shut manually while it is producing, it is making no difference to the kafka producer