View Source Avrora.Storage.Registry (avrora v0.25.0)

Avora.Storage behavior implementation which uses Confluent Schema Registry.

This only implements the minimum client functionality needed to talk with the registry. Inspired by Schemex.

Link to this section Summary

Functions

Get schema by integer ID or by the subject name.

Register new version of schema under subject name.

Link to this section Functions

Get schema by integer ID or by the subject name.

If subject name was used by default the latest version will be used unless it explicitly given (e.g io.confluent.Payment:1).

examples

Examples

...> {:ok, schema} = Avrora.Storage.Registry.get(1)
...> schema.full_name
"io.confluent.Payment"
...> {:ok, schema} = Avrora.Storage.Registry.get("io.confluent.Payment")
...> schema.full_name
"io.confluent.Payment"

Register new version of schema under subject name.

examples

Examples

...> schema = ~s({"fields":[{"name":"id","type":"string"},{"name":"amount","type":"double"}],"name":"Payment","namespace":"io.confluent","type":"record"})
...> {:ok, schema} = Avrora.Storage.Registry.put("io.confluent.examples.Payment", schema)
...> schema.full_name
"io.confluent.Payment"