Skip to content

Apache Avro serialization/deserialization with Confluent Schema Registry framing using Apicurio Schema Registry

License

Notifications You must be signed in to change notification settings

castoredc/avrocurio.go

Repository files navigation

AvroCurio

Apache Avro serialization/deserialization with Confluent Schema Registry framing using Apicurio Schema Registry.

This is a Go port of the Python AvroCurio library, designed to provide the same functionality with idiomatic Go patterns.

Quickstart

Refer to ExampleAvroSerializer which shows a basic usage example of how to use this library. Don't forget to add it your project first:

go get github.com/castoredc/avrocurio.go

Confluent Schema Registry Wire Format

AvroCurio implements the Confluent Schema Registry wire format:

+----------------+------------------+------------------+
| Magic Byte     | Schema ID        | Avro Payload     |
| (1 byte = 0x0) | (4 bytes, BE)    | (remaining)      |
+----------------+------------------+------------------+
  • Magic Byte: Always 0x0 to identify Confluent wire format
  • Schema ID: 4-byte big-endian integer referencing the schema in the registry
  • Avro Payload: Standard Avro binary-encoded data

Schema Caching

Schema caching is handled automatically by the ApicurioClient for performance.

Successful schema lookups are cached indefinitely. Failed lookups are cached with a TTL to avoid constant repeated failed requests, but allow retries over time in case the error is transient.

Development

Requirements

Integration tests require a running Apicurio Registry. Running it through Docker using Compose is easiest:

docker compose up

Port 8080 is assumed by default, but you can set APICURIO_URL to point to a different instance.

Just is used for task automation and must be installed as well.

Running Tests

# Run unit tests
just test

# Run tests with race detection
just test-race

# Run tests with coverage
just test-cover

# Run integration tests (requires running Apicurio Registry)
just test-integration

License

AvroCurio is open-source software released under the BSD-2-Clause Plus Patent License. This license is designed to provide: a) a simple permissive license; b) that is compatible with the GNU General Public License (GPL), version 2; and c) which also has an express patent grant included.

Please review the LICENSE file for the full text of the license.

About

Apache Avro serialization/deserialization with Confluent Schema Registry framing using Apicurio Schema Registry

Resources

License

Stars

Watchers

Forks

Packages

No packages published