apache-kafkaconfluent-platformkafka-rest

Is there a way to produce Kafka messages with headers using Kafka Confluent REST API?


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\"}"
    }]
}

Solution

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