根据Kafka文档
连接器配置是简单的键值映射。对于独立 这些模式在属性文件中定义并传递给Connect 在命令行上处理。
大多数配置取决于连接器,因此无法概述它们 这里。但是,有一些常用选项:
name - Unique name for the connector. Attempting to register again with the same name will fail.
我有10个以独立模式运行的连接器,如下所示:
bin/connect-standalone.sh config/connect-standalone.properties connector1.properties connector2.properties ...
我的问题是连接器可以在运行时加载其自己的名称吗?
谢谢。
答案 0 :(得分:1)
是的,您可以在运行时获取连接器的名称。
连接器启动时,所有属性都传递给Connector::start(Map<String, String> props)
。连接器可以读取这些属性,对其进行验证,保存并随后传递给Task
。是否使用连接器取决于它的实现。
连接器名称属性为name
。