Elixir - Registry


it’s common to have a registry of processes where each process can be accessed by its name (say, registry of user stores accessed by user_id).

registry can be implemented in several ways based on how new process is going to be registered in that registry:

using atom

using {:via, module, term} tuple

from now on I’ll refer to registries accessed with via tuple as via registries.

the benefit of via registries is that you don’t have to interact with them directly when registering new processes - it’s done automatically when using via tuple in process client API (each process is GenServer itself as a rule).

via registry is started as part of supervision tree by top-level supervisor.