Skip to content

Multi-client 👫 support

Compare
Choose a tag to compare
@Strech Strech released this 09 Feb 10:35
· 57 commits to master since this release
a143537

In this release, Avrora finally gets multi-client support. From now on you can use a shared client Avrora or make as many you need private clients which will 100% equivalent to the Avrora one.

Private clients are totally isolated. They don't share cache nor configuration. To have one you can use a special Avrora.Client macros to generate it.

defmodule MyClient do
  use Avrora.Client,
    registry_url: "http://localhost:8081",
    registry_auth: {:basic, ["username", "password"]}
    schemas_path: Path.expand("./priv/schemas"),
    registry_schemas_autoreg: false,
    convert_null_values: false,
    convert_map_to_proplist: false
    names_cache_ttl: :timer.minutes(5)
end

and then you can add it to your supervision tree or start the process manually

children = [
  MyClient
]

Supervisor.start_link(children, strategy: :one_for_one)

# or

{:ok, pid} = MyClient.start_link()

Enjoy!

Special thanks 👏🏼 for the feature request to @arusahni 💚