mudasobwa
Creator of Cure
Since OTP 25.1 we have a process groups monitoring so I finally made an implementation of distributed Registry leveraging :pg and an [almost] drop-in distributed replacement for local DynamicSupervisor.
❯ iex --sname n1 -S mix
iex(n1@am-victus)1> DistributedSupervisor.start_link name: DS, listeners: DistributedSupervisor.Test.Listener, cache_children?: true, monitor_nodes: true
{:ok, #PID<0.254.0>}
iex(n1@am-victus)2> Node.connect :"n2@am-victus"
true
iex(n1@am-victus)3> DistributedSupervisor.start_child DS, {DistributedSupervisor.Test.GenServer, name: Foo1}
{:ok, #PID<24436.263.0>, Foo1}
iex(n1@am-victus)4> DistributedSupervisor.start_child DS, {DistributedSupervisor.Test.GenServer, name: Foo2}
{:ok, #PID<24436.264.0>, Foo2}
iex(n1@am-victus)5> DistributedSupervisor.start_child DS, {DistributedSupervisor.Test.GenServer, name: Foo3}
{:ok, #PID<0.265.0>, Foo3}
iex(n1@am-victus)6> DistributedSupervisor.children DS
%{
Foo1 => #PID<24436.263.0>,
Foo2 => #PID<24436.264.0>,
Foo3 => #PID<0.265.0>,
}
iex(n1@am-victus)7> DistributedSupervisor.whereis DS, Foo1
#PID<24436.263.0>
iex(n1@am-victus)8> DistributedSupervisor.via_name DS, Foo1
{:via, DistributedSupervisor.Registry, {DS, Foo1}}
iex(n1@am-victus)9> GenServer.whereis v()
#PID<24436.263.0>
It supports listener(s) to be attached to each DistributedSupervisor “instance,” identified by a name, to be informed about processes going up/down and nodes going up/down.
Enjoy.
Trending in Announcing
Hey everyone!
Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application.
This library uses Erlang esaml to provide
plug enabl...
New
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub.
Docs are at OpenaiEx User Gu...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi all!
I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas.
You...
New
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto.
pagination
cursor pagination
sorta...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming









