Using Apache Avro serializer/deserializer
If you are using Apache Avro serializer/deserializer, please note the following configuration properties.
For Confluent Schema Registry
Confluent Avro library is io.confluent:kafka-avro-serializer
. Note
that this library is not available in Maven Central, you need to use the
Confluent Maven
repository.
Consumer
Property | Recommended value |
---|---|
value.deserializer | io.confluent.kafka.serializers.KafkaAvroDeserializer |
schema.registry.url | http://{your_host}:{your_port}/ |
specific.avro.reader | true |
Example:
1 2 3 |
|
Producer
Property | Recommended value |
---|---|
value.serializer | io.confluent.kafka.serializers.KafkaAvroSerializer |
schema.registry.url | http://{your_host}:{your_port}/ |
Example:
1 2 |
|
For Apicurio Registry 1.x
Apicurio Registry 1.x Avro library is
io.apicurio:apicurio-registry-utils-serde
.
The configuration properties listed here are meant to be used with the Apicurio Registry 1.x client library and Apicurio Registry 1.x server.
Consumer
Property | Recommended value |
---|---|
value.deserializer | io.apicurio.registry.utils.serde.AvroKafkaDeserializer |
apicurio.registry.url | http://{your_host}:{your_port}/api |
apicurio.registry.avro-datum-provider | io.apicurio.registry.utils.serde.avro.DefaultAvroDatumProvider |
apicurio.registry.use-specific-avro-reader | true |
Example:
1 2 3 4 |
|
Producer
Property | Recommended value |
---|---|
value.serializer | io.apicurio.registry.utils.serde.AvroKafkaSerializer |
apicurio.registry.url | http://{your_host}:{your_port}/api |
To automatically register schemas with the registry, add:
Property | Value |
---|---|
apicurio.registry.global-id | io.apicurio.registry.utils.serde.strategy.GetOrCreateIdStrategy |
Example:
1 2 3 |
|
For Apicurio Registry 2.x
Apicurio Registry 2.x Avro library is
io.apicurio:apicurio-registry-serdes-avro-serde
.
The configuration properties listed here are meant to be used with the Apicurio Registry 2.x client library and Apicurio Registry 2.x server.
Consumer
Property | Recommended value |
---|---|
value.deserializer | io.apicurio.registry.serde.avro.AvroKafkaDeserializer |
apicurio.registry.url | http://{your_host}:{your_port}/apis/registry/v2 |
apicurio.registry.use-specific-avro-reader | true |
Example:
1 2 3 |
|
Producer
Property | Recommended value |
---|---|
value.serializer | io.apicurio.registry.serde.avro.AvroKafkaSerializer |
apicurio.registry.url | http://{your_host}:{your_port}/apis/registry/v2 |
To automatically register schemas with the registry, add:
Property | Value |
---|---|
apicurio.registry.auto-register | true |
Example:
1 2 3 |
|