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

拜拜、爱过 提交于 2020-08-19 10:24:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!