Can a Kafka Connector load its own name?

て烟熏妆下的殇ゞ 提交于 2020-01-05 05:17:10

问题


According to Kafka Documentation

Connector configurations are simple key-value mappings. For standalone mode these are defined in a properties file and passed to the Connect process on the command line.

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.

I have 10 connectors running in standalone mode like this:

bin/connect-standalone.sh config/connect-standalone.properties connector1.properties connector2.properties ...

My question is can a connector load its own name at runtime?

Thanks in advance.


回答1:


Yes, you can get the name of the connector at runtime.

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.

Connector name property is name.



来源:https://stackoverflow.com/questions/55301475/can-a-kafka-connector-load-its-own-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!