问题
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\"}"
}]
}
回答1:
You are correct, the REST Proxy does not currently support Kafka Headers. You would need to use the Producer API to set the headers.
来源:https://stackoverflow.com/questions/55036037/is-there-a-way-to-produce-kafka-messages-with-headers-using-kafka-confluent-rest