简体   繁体   English

从一个集群到多个集群的KStream

[英]KStream from one cluster to many

I need to have one java module in my Kafka cluster that will get a message, and depending on two fields of the message, it would be enriched and published to another kafka cluster. 我需要在我的Kafka集群中有一个Java模块来获取一条消息,并且根据消息的两个字段,它将被充实并发布到另一个kafka集群中。 I've been researching KStream API and I can't find a way to send things to another cluster (without using the publisher library). 我一直在研究KStream API,但找不到一种将内容发送到另一个群集的方法(不使用发布者库)。

Any ideas and how can I do this? 有什么想法,我该怎么做?

Thanks! 谢谢!

I need to have one java module in my Kafka cluster that will get a message, and depending on two fields of the message, it would be enriched and published to another kafka cluster. 我需要在我的Kafka集群中有一个Java模块来获取一条消息,并且根据消息的两个字段,它将被充实并发布到另一个kafka集群中。 I've been researching KStream API and I can't find a way to send things to another cluster (without using the publisher library). 我一直在研究KStream API,但找不到一种将内容发送到另一个群集的方法(不使用发布者库)。

At the moment, the Kafka's Streams API interacts only with one given cluster at a time. 目前,Kafka的Streams API一次只能与一个给定的集群进行交互。 That is, you cannot read from Kafka cluster A and then write to Kafka cluster B with the Streams API. 也就是说,您无法从Streams API读取Kafka群集A,然后再写入Kafka群集B。

Any ideas and how can I do this? 有什么想法,我该怎么做?

I'd therefore recommend to use Kafka Connect for this. 因此,我建议为此使用Kafka Connect。 The latest versions of Kafka include the so-called Single Message Transformations feature in Kafka Connect, which you can use for such routing of messages. Kafka的最新版本在Kafka Connect中包括所谓的“ 单个消息转换”功能,您可以将其用于消息的这种路由。

If you are open to use a commercial tool, Confluent Replicator ( docs ) allows you to do such cross-cluster data flows, as Hans Jespersen mentioned above. 如果您愿意使用商业工具,那么Confluent Replicatordocs )允许您进行此类跨集群数据流,如Hans Jespersen所述。

A good high-level starting point would be the talk Single Message Transformations Are Not the Transformations You're Looking For (don't be deterred by the title :-P) by Ewen Cheslack-Postava, one of the Kafka committers who developed the new SMT feature. 一个好的高级起点是“ 单消息转换不是您正在寻找的转换” (不要被标题:-P阻止),作者是Ewen Cheslack-Postava,他是开发Kafka的Kafka提交者之一。新的SMT功能。 There's also a blog post that briefly describes SMT in Kafka Connect. 还有一篇博客文章简要介绍了Kafka Connect中的SMT。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM