从Kafka连接器中获取数据来自数据库

huangapple go评论63阅读模式
英文:

Fetching data from DB via Kafka Connectors

问题

在Mongo DB上通过Kafka连接器按需查询数据是否可行?

例如,假设我有一组汽车数据如下 -

{
       Brand: Mahindra,
       Model: XUV300
}
{
       Brand: Mahindra,
       Model: XUV500
}
{
       Brand: TATA,
       Model: Nexon
}

我想通过Kafka连接器获取所有Mahindra的车型。
我应该怎么做才能查询并将这些数据放入我的一个Kafka主题中?

目标是通过Kafka来控制一切,而不是直接通过代码与数据库交互。
尝试查阅Kafka文档和Google,但没有找到任何解决方案。

英文:

Is it’s possible to query data on demand from a DB (e.g. Mongo DB) via Kafka connectors?

i.e. let’s say I have a collection of cars with the following data –

{
       Brand: Mahindra,
       Model: XUV300
}
{
       Brand: Mahindra,
       Model: XUV500
}
{
       Brand: TATA,
       Model: Nexon
}

I want to fetch all Mahindra Models via Kafka connector.
What should I do so I can query and get this data in one of my Kafka topics?

The aim is to control everything via Kafka and not to interact directly with db via code.
Tried going through Kafka doc and Google but didn't find any solutions

答案1

得分: 1

以下是翻译好的内容:

有些连接器确实允许自定义筛选查询,比如 JDBC 源。

否则,您可以尝试使用带有谓词的 Filter SMT 来筛选记录中的数据。

链接地址:https://docs.confluent.io/platform/current/connect/transforms/filter-confluent.html

英文:

Some connectors do allow custom filters queries, such as the JDBC source.

Otherwise, you can try to use the Filter SMT with a predicate to filter data that's part of the record

https://docs.confluent.io/platform/current/connect/transforms/filter-confluent.html

huangapple
  • 本文由 发表于 2023年7月3日 18:34:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76603914.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定