We are publishing header information using kafka-python like below:
def publish_message1(self, interface_time, topic_name, value, success_call_back, error_call_back, key=None):
if self.kafka_producer:
value_bytes = bytes(value, encoding='utf-8')
time_bytes = bytes(interface_time, encoding='utf-8')
if key:
key_bytes = bytes(key, encoding='utf-8')
self.kafka_producer.send(topic_name, value=value_bytes, key=key_bytes, headers=[('Collection_Timestamp', time_bytes)])\
.add_callback(success_call_back).add_errback(error_call_back)
else:
raise Exception("Connection not exists with Kafka to publish message")
The header info is showing in Kafka tool and it is getting published successfully. When we are trying to consume, header=[] is coming as empty list.
Note: kafka-python version which we are using is "2.0.2" Please let me know what is going wrong.