Apache Nifi:有没有一种方法可以将消息密钥作为多个属性的组合发布到kafka? [英] Apache Nifi: Is there a way to publish messages to kafka with a message key as combination of multiple attributes?

查看:63
本文介绍了Apache Nifi:有没有一种方法可以将消息密钥作为多个属性的组合发布到kafka?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我需要阅读CSV并将其发布为Avro格式的Kafka主题.在发布期间,我需要将消息密钥设置为两个属性的组合.假设我有一个名为id的属性和一个名为group的属性.我需要我的消息密钥为id +-" + group.有没有办法可以在Apache nifi流中实现这一目标?将消息键设置为单个属性对我来说很好.

I have a requirement where I need to read a CSV and publish to Kafka topic in Avro format. During the publish, I need to set the message key as the combination of two attributes. Let's say I have an attribute called id and an attribute called group. I need my message key to be id+"-"+group. Is there a way I can achieve this in Apache nifi flow? Setting the message key to a single attribute works fine for me.

推荐答案

请注意每个属性上的(?)指示允许或不允许的内容:

Notice the (?)s on each property which indicates what is or isn't allowed:

当字段不是表达式语言时,请使用updateAttribute处理器设置所需的组合值.然后,您可以在下游使用合并值.

When a field doesn't except expression languages, use an updateAttribute processor to set the combined value you need. Then you use the combined value downstream.

这篇关于Apache Nifi:有没有一种方法可以将消息密钥作为多个属性的组合发布到kafka?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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