[英]Spring Kafka + Json + Schema Registry Confluent
Confluent schema registry currently support json schema. Confluent 模式注册表当前支持 json 模式。 Does spring kafka provides support for json schema?
spring kafka 是否提供对 json 架构的支持?
Avro with spring kafka works well using this config带有 spring kafka 的 Avro 使用此配置运行良好
spring:
kafka:
producer:
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
consumer:
group-id: template-cg
auto-offset-reset: earliest
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: io.confluent.kafka.serializers.KafkaAvroDeserializer
properties:
schema.registry.url: "http://localhost:8081"
But how to configure spring kafka to use json schema + confluent schema registry?但是如何配置 spring kafka 以使用 json 模式 + 融合模式注册表?
OK, as gary guides, this is not spring problem.好的,作为加里指南,这不是 spring 问题。 Need to configure kafka like this.
需要像这样配置kafka。
spring:
kafka:
producer:
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: io.confluent.kafka.serializers.json.KafkaJsonSchemaSerializer
consumer:
group-id: template-cg
auto-offset-reset: earliest
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: io.confluent.kafka.serializers.json.KafkaJsonSchemaDeserializer
properties:
schema.registry.url: http://localhost:8081
Dependency (gradle)依赖(gradle)
repositories {
mavenCentral()
maven {
url "https://packages.confluent.io/maven/"
}
maven {
url "https://jitpack.io"
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'io.confluent:kafka-json-schema-serializer:6.1.0'
implementation 'com.github.everit-org.json-schema:org.everit.json.schema:1.12.2'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.