Kafkacat Produce message from a file with headers

Viewed 825

I need to produce batch messages to Kafka so I have a file that I feed kafkacat:

kafkacat -b localhost:9092 -t <my_topic> -T -P -l /tmp/msgs

The content of /tmp/msgs is as follows

-H "id=1"
{"key" : "value0"}
-H "id=2"
{"key" : "value1"}

When I run the kafkacat command above, it inserts four messages to kafka - one message per line in /tmp/msgs.

I need to instruct kafkacat to parse the file correctly - that is -H "id=1" is the header for the message {"key" = "value0"}.

How do I achieve this?

Thanks

0 Answers
Related