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

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

问题描述

根据 Kafka 文档

According to Kafka Documentation

连接器配置是简单的键值映射.对于独立mode 这些在属性文件中定义并传递给 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 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天全站免登陆