/hydrax

Convenience wrapper around Horde

Primary LanguageElixirApache License 2.0Apache-2.0

Hydrax

Hex.pm

Shared functionality for working with PIDs across a distributed cluster. Acts as a wrapper around Horde, providing a few convenience functions such as helpers for working with two-element registry keys.

Installation

The package can be installed by adding hydrax to your list of dependencies in mix.exs:

def deps do
  [
    {:hydrax, "~> 0.3"},
  ]
end

Then add either the Registry, Supervisor, or both to your application tree:

defmodule Application do
  @moduledoc false

  use Application

  @impl true
  def start(_type, _args) do
    children = [
      Hydrax.Registry,
      Hydrax.Supervisor,
      # other children
    ]

    opts = [strategy: :one_for_one, name: Application]
    Supervisor.start_link(children, opts)
  end
end

The Registry and Supervisor are thin wrappers around Horde.Registry and Horde.DynamicSupervisor. The Horde documentation is the best place to learn how to use these.