toolisticon / avro-kotlin

Opionionated set of extension functions and helpers for using Apache Avro with Kotlin
https://avro-kotlin.toolisticon.io/stable/
Apache License 2.0
3 stars 0 forks source link
avro kotlin

avro-kotlin

Avro Kotlin provides a type- and null-safe type-system that encapsulates the apache-java avro-types and makes them easily accessible from kotlin. The mission is to become your one-stop lib when dealing with avro and kotlin.

stable Maven Central Kotlin Kotlinx serialization Avro spec Build Status codecov sponsored

[!NOTE] Since Version 1.11.4.2 we use a multi-module build. The GroupId changed, best use the provided BOM:

<dependency>
<groupId>io.toolisticon.kotlin.avro</groupId>
<artifactId>avro-kotlin-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
</dependency>

Apache Avro

Apache Avro is a data serialization system.

Avro provides:

  • Rich data structures.

  • A compact, fast, binary data format.

  • A container file, to store persistent data.

  • Remote procedure call (RPC).

  • Simple integration with dynamic languages. Code generation is not required to read or write data files nor to use or implement RPC protocols. Code generation as an optional optimization, only worth implementing for statically typed languages.

see: Avro Documentation

To simplify usage of the org.apache.avro:avro-core lib (written in java) from kotlin, this library wraps the java implementation. Parsing declarations and generating schema is still done using the underlying official library, but we built tools, wrappers and helpers on top.

why?

Working with avro files (reading, writing, copying, modifying, ...) can quickly become cumbersome, because the jvm file/resource io is far from convenience.

This lib provides simplified access to avro schema and protocol files by giving you fromResource, fromDirectory and writeToFile methods to read and write .avsc and .avpr files.

The assumption is, that the location of an avro file follows the java fqn/package convention, so when you have namespace=com.acme.foo and name=MySchema, the file/resource is expected under com/acme/foo/MySchema.avsc.

how?

Build

Semantic Versioning

To reflect the version of the underlying avro-core library, we use a 4-digit semantic versioning concept (semVer). Take the current release version: 1.11.2.0, which uses version 1.11.3 of the avro-core lib:

Releases

Project Structure