Kafka Registryless Avro Serdes

A Serdes for serializing / deserializing Avro records without a schema registry

License

License

GroupId

GroupId

com.mitchseymour
ArtifactId

ArtifactId

kafka-registryless-avro-serdes
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

Kafka Registryless Avro Serdes
A Serdes for serializing / deserializing Avro records without a schema registry
Project URL

Project URL

https://github.com/mitch-seymour/kafka-registryless-avro-serdes
Source Code Management

Source Code Management

https://github.com/mitch-seymour/kafka-registryless-avro-serdes

Download kafka-registryless-avro-serdes

Dependencies

runtime (2)

Group / Artifact Type Version
org.apache.avro : avro jar 1.8.2
joda-time : joda-time jar 2.10.1

Project Modules

There are no modules declared in this project.

Kafka Registryless Avro Serdes

Maven Central

If you want to use Avro in your Kafka project, but aren't using Confluent Schema Registry, you can use this Avro Serdes instead. Note that the record schema will be serialized with each message.

Install

dependencies {
  implementation 'com.mitchseymour:kafka-registryless-avro-serdes:0.1.0'
}

Usage

Once you've generated your classes from an Avro schema file, for example, with the gradle-avro-plugin, you can use the AvroSerdes#get method to generate an Avro Serdes for a generated class. For example, if you generated a class named Tweet from the following definition:

{
    "namespace": "com.mitchseymour.model",
    "name": "Tweet",
    "type": "record",
    "fields": [
      {
        "name": "id",
        "type": "long"
      },
      {
        "name": "text",
        "type": "string"
      }
    ]
 }

You could then create an Avro Serde for that class using this code:

Serde<Tweet> serde = AvroSerdes.get(Tweet.class);

The resulting Serde can be used anywhere you would normally use one of Kafka's built-in Serdes. For example, in a Kafka Streams app, you could do this:

stream.to("tweets", Produced.with(Serdes.String(), AvroSerdes.get(Tweet.class)));

Versions

Version
1.0.0
0.1.2
0.1.1
0.1.0