如何指定在kafka confluent connector中收听哪个主题?

How to specify which topic to listen to in kafka confluent connector?

我最近一直在研究 kafka 连接器,我想知道在哪里配置我的接收器连接器的工作任务应该监听的主题。

通常 SinkConnectorConfig 看起来像这样

name=MySinkConnector
tasks.max=1
connector.class=com.operative.creative.bi.sink.MySinkConnector
topics=demo
filePath=/tmp/output.txt

并且在使用 rest-proxy 控制 worker 配置时可以覆盖这些设置。我想知道我们在哪里指定主题。

我知道 属性 文件定义了一个名为 "topics" 的 属性,但我在样板代码中没有看到任何内容。

任何帮助将不胜感激。

topic = props.get(TOPIC_CONFIG);

看看https://docs.confluent.io/current/connect/devguide.html#connector-example, and also https://gist.github.com/jcustenborder/b9b1518cc794e1c1895c3da7abbe9c08