New schema registration functionality
In this release, a new module responsible for schema registration arises. Welcome Avrora.Utils.Registrar
. It's designed to be used in the client code because it's using Avrora.Storage.Memory
to prevent performance issues.
It allows you to control the name your AVRO schemas will be registered at (i.esubject
in Schema Registry).
defmodule Sample do
alias Avrora.Utils.Registrar
def loop do
Enum.reduce_while(1..100, 0, fn x, acc ->
if x < 100, do: {:cont, register("io.confluent.Payment")}, else: {:halt, acc}
end)
end
defp register(schema_name), do: Registrar.register_schema_by_name(schema_name)
end
In addition, a mix
task for schema registration was refactored (#65) to use this new functionality and now supports a new argument --as
which in combination with --name
option allows you to change the subject
.
$ mix avrora.reg.schema --name io.confluent.Payment --as MyCustomName
schema `io.confluent.Payment' will be registered as `MyCustomName'