5

I'm trying to send messages to Kafka with some custom headers, but I could't find a way to do it. According to the documatation, The POST /topics/(string: topic_name) API does not have a way to attach custom headers to messages.

Does anyone know a way to send Kafka messages with custom headers through the confluent Kafka REST API?

Here is my sample request body I sent to the REST proxy

POST /topics/stream.mycustomtopic

{
    "records": [{
        "value": "{\"myFirstKey\":\"myFirstValue\"}"
    }]
}
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
ArmWich
  • 103
  • 1
  • 7

1 Answers1

4

You are correct, the REST Proxy does not currently support Kafka Headers. You would need to use the Producer API to set the headers.

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92
  • It's not supported by the REST Proxy. There's an open issue here https://github.com/confluentinc/kafka-rest/issues/523 to track if you want. – Robin Moffatt May 07 '20 at 12:39