java在Kafka Connect中添加新的自定义属性
我正在尝试添加新的自定义Kafka转换器,它是对connectjson中的JsonConverterConfig的修改。我正在尝试在扩展JsonConverterConfig的转换器中添加一些新的自定义属性,例如schemas.modifications.enable“。但是Kafka connect无法找到有关转换器的详细信息。 我的代码片段:
public class ModifiedJsonConfig extends JsonConverterConfig {
public static final String SCHEMAS_MODIFY_CONFIG = "schemas.modifications.enable";
public static final boolean SCHEMAS_MODIFY_CONFIG_DEFAULT = true;
private static final String SCHEMAS_MODIFY_CONFIG_DOC = "The maximum number of schemas that can be cached in this converter instance.";
private static final String SCHEMAS_MODIFY_CONFIG_DISPLAY = "Schema Cache Size";
private final static ConfigDef CONFIG;
static {
String group = "Schemas-modification";
int orderInGroup = 0;
CONFIG = ConverterConfig.newConfigDef();
CONFIG.define(SCHEMAS_MODIFY_CONFIG, Type.BOOLEAN, SCHEMAS_MODIFY_CONFIG_DEFAULT, Importance.HIGH, SCHEMAS_MODIFY_CONFIG_DOC, group,
orderInGroup++, Width.MEDIUM, SCHEMAS_MODIFY_CONFIG_DISPLAY);
}
public static ConfigDef configDef() {
return CONFIG;
}
public ModifiedJsonConfig(Map<String, ?> props) {
super(props);
}
public boolean schemasModified() {
return getBoolean(SCHEMAS_MODIFY_CONFIG);
}
}
但我在这里得到了一个错误:
ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectDistributed:83) org.apache.kafka.common.config.ConfigException: Unknown configuration 'schemas.modifications.enable'
但是我已经定义了这个配置。如果您能帮我在这里设置自定义转换器属性,那将非常有用
提前谢谢
共 (0) 个答案