[英]Fields to topic from MongoDB
I want to run a Kafka Connect as a Source with the required fields from Mongo, and not pull together the entire collection.我想使用 Mongo 的必填字段将 Kafka Connect 作为源运行,而不是将整个集合放在一起。 Is this possible?
这可能吗? For Example: I have collection
例如:我有收藏
{ contact_name: "Ace Farad", contact_uid: "HdeofVad" }
but to topic I need to send only contact_name.但是对于主题,我只需要发送contact_name。 Thanks!
谢谢!
Use a transform to drop a field使用转换删除字段
"transforms": "ReplaceField",
"transforms.ReplaceField.type": "org.apache.kafka.connect.transforms.ReplaceField$Value",
"transforms.ReplaceField.blacklist": "contact_uid"
https://docs.confluent.io/platform/current/connect/transforms/replacefield.html https://docs.confluent.io/platform/current/connect/transforms/replacefield.html
Note: this may only work for top level fields, not nested collections注意:这可能仅适用于顶级字段,不适用于嵌套 collections
The alternative is to read all the data into a "raw" topic, then manipulate it how you want inside of Kafka另一种方法是将所有数据读入一个“原始”主题,然后在 Kafka 中按照您的需要对其进行操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.