问题描述
根据Kafka文档
大多数配置取决于连接器,因此无法概述它们 这里.但是,有一些常用选项:
Most configurations are connector dependent, so they can't be outlined here. However, there are a few common options:
name - Unique name for the connector. Attempting to register again with the same name will fail.
我有10个以独立模式运行的连接器,如下所示:
I have 10 connectors running in standalone mode like this:
bin/connect-standalone.sh config/connect-standalone.properties connector1.properties connector2.properties ...
我的问题是连接器可以在运行时加载其自己的名称吗?
谢谢.
推荐答案
是的,您可以在运行时获取连接器的名称.
Yes, you can get the name of the connector at runtime.
当连接器启动时,所有属性都传递给Connector::start(Map<String, String> props)
.连接器可以读取这些属性,对其进行验证,保存并随后传递给Task
.是否使用连接器取决于它的实现.
When connector starts all properties are passed to Connector::start(Map<String, String> props)
. Connector can read those properties, validate them, save and later pass to Task
. It depends on Connector implementation if he use it or not.
连接器名称属性为name
.
这篇关于Kafka连接器可以加载自己的名称吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!