Apache kafka ProcessorContext#header()为空
我们有卡夫卡流应用程序。制作人在将kafka消息发送到kafka流媒体应用程序之前,正在kafka消息中添加头 在卡夫卡流媒体应用程序中,我们使用Apache kafka ProcessorContext#header()为空,apache-kafka,apache-kafka-streams,Apache Kafka,Apache Kafka Streams,我们有卡夫卡流应用程序。制作人在将kafka消息发送到kafka流媒体应用程序之前,正在kafka消息中添加头 在卡夫卡流媒体应用程序中,我们使用AbstractProcessor和context.forward(null,可选.of(event))将消息转发到其他主题 但标题正在丢失。我希望标题从输入消息到输出主题保持原样 ProcessorContext接口headers()方法返回当前输入记录的标题,但在我的示例中,它是空的,尽管我正在发送带有标题的消息 * Returns th
AbstractProcessor
和context.forward(null,可选.of(event))代码>将消息转发到其他主题
但标题正在丢失。我希望标题从输入消息到输出主题保持原样
ProcessorContext
接口headers()
方法返回当前输入记录的标题,但在我的示例中,它是空的,尽管我正在发送带有标题的消息
* Returns the headers of the current input record; could be null if it is not available
* @return the headers
*/
Headers headers();
Kafka Stream API版本:2.3.1context.headers()
如果使用处理器,则应在process()
中调用;如果使用转换器,则应在transform()
中调用。在哪里调用context.headers()
。它是否在处理器的进程()
内?已解决。我在og进程方法外部调用context.headers()。