Spring Kafka Multiple Schema registry with Multiple Kafka Templates
Spring Kafka Multiple Schema registries with Multiple Kafka Templates
从 Spring Kafka 2.5 onwards it is possible to have multiple Kafka templates based on different producer config 的文档来看,模板的键和值类型似乎有所不同。
在 Spring 引导服务中,
Is it possible to have multiple Spring Kafka Templates with same Key
and Value types, the templates only different in their producer configurations
即例如:
KafkaTemplate<String, String> defaultKafkaTemplate
KafkaTemplate<String, String> anotherKafkaTemplate
如果以上问题的答案是肯定的:
Is it possible to have a separate schema registry for each of those
templates
即
defaultkafkaTemplate is tied to schema 1 present in Registry A
anotherkafkaTemplate is tied to schema 10 present in Registry B
我能够将单个 AWS Glue Schema 注册表与 Spring Kafka 提供的 KafkaTemplate 集成,想知道上述情况是否可行?
是的,你可以定义两个bean:
@Bean
KafkaTemplate<String, String> defaultTemplate(ProducerFactory<String, String> pf) {
return new KafkaTemplate<>(pf);
}
@Bean
KafkaTemplate<String, String> otherTemplate(ProducerFactory<String, String> pf) {
return new KafkaTemplate<>(pf, Map.of("some.property", "other.value");
}
如果您定义任何 KafkaTemplate
个 bean,Boot 将不会自动配置一个。
从 Spring Kafka 2.5 onwards it is possible to have multiple Kafka templates based on different producer config 的文档来看,模板的键和值类型似乎有所不同。
在 Spring 引导服务中,
Is it possible to have multiple Spring Kafka Templates with same Key and Value types, the templates only different in their producer configurations
即例如:
KafkaTemplate<String, String> defaultKafkaTemplate
KafkaTemplate<String, String> anotherKafkaTemplate
如果以上问题的答案是肯定的:
Is it possible to have a separate schema registry for each of those templates
即
defaultkafkaTemplate is tied to schema 1 present in Registry A anotherkafkaTemplate is tied to schema 10 present in Registry B
我能够将单个 AWS Glue Schema 注册表与 Spring Kafka 提供的 KafkaTemplate 集成,想知道上述情况是否可行?
是的,你可以定义两个bean:
@Bean
KafkaTemplate<String, String> defaultTemplate(ProducerFactory<String, String> pf) {
return new KafkaTemplate<>(pf);
}
@Bean
KafkaTemplate<String, String> otherTemplate(ProducerFactory<String, String> pf) {
return new KafkaTemplate<>(pf, Map.of("some.property", "other.value");
}
如果您定义任何 KafkaTemplate
个 bean,Boot 将不会自动配置一个。