Kafka连接器可以加载自己的名称吗? [英] Can a Kafka Connector load its own name?

查看:69
本文介绍了Kafka连接器可以加载自己的名称吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Kafka文档

连接器配置是简单的键-值映射.对于独立 这些模式在属性文件中定义并传递给Connect 在命令行上进行处理.

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.

我有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连接器可以加载自己的名称吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆