有没有一种方法可以使用Kafka Confluent REST API生成带有标头的Kafka消息? [英] Is there a way to produce Kafka messages with headers using Kafka Confluent REST API?

查看:389
本文介绍了有没有一种方法可以使用Kafka Confluent REST API生成带有标头的Kafka消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用一些自定义标头将消息发送到Kafka,但我找不到解决方法.根据文档POST /topics/(string: topic_name) 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.

有人知道通过融合的Kafka REST API发送带有自定义标头的Kafka消息的方法吗?

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

这是我发送给REST代理的示例请求正文

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

POST /topics/stream.mycustomtopic

{
    "records": [{
        "value": "{\"myFirstKey\":\"myFirstValue\"}"
    }]
}

推荐答案

您是正确的,REST代理当前不支持Kafka标头.您需要使用生产者API 设置标头.

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

这篇关于有没有一种方法可以使用Kafka Confluent REST API生成带有标头的Kafka消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆