自定义 AdminClient 配置
与上面的消费者和生产者配置自定义一样,应用程序还可以通过提供AdminClientConfigCustomizer
.
AdminClientConfigCustomizer 的 configure 方法提供对管理客户端属性的访问,您可以使用它定义进一步的自定义。
Binder 的 Kafka 主题配置器为通过此定制器提供的属性提供了最高优先级。
下面是提供此定制器 bean 的示例。
@Bean
public AdminClientConfigCustomizer adminClientConfigCustomizer() {
return props -> {
props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_SSL");
};
}