有没有办法使用 Kafka Confluent REST API 生成带有标题的 Kafka 消息? [英] Is there a way to produce Kafka messages with headers using Kafka Confluent REST API?

查看:36
本文介绍了有没有办法使用 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 标头.您需要使用 Producer 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天全站免登陆