I need to post the consumer record data to kafka topic using producer, While posting it was throwing an error :
Magic v1 does not support add headers...
I checked the broker version also and changed into old jar version. But it always shows an error. for consumer and producer same bootstrap servers host am using, below code I tried
kafka client version is 2.0.1 zkclient version is 0.10
consumer code sender
is method name
for (ConsumerRecord<String, String> record : records) {
sender(record.key(), record.value());
}
producer code :
public static void sender(String key, String Value) throws Exception {
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("key.serializer","org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
KafkaProducer<String, String> producer = new KafkaProducer<String, String>(props);
ProducerRecord<String, String> prodrecord = new ProducerRecord<String, String>(TopicName, key, Value);
producer.send(prodrecord);
}
Thanks in advance