greyhound v0.1.0 Greyhound.Listeners

Registry for tracking listener processes.

Link to this section Summary

Functions

Registers a pid to a topic

Returns a specification to start this module under a supervisor

Returns a list of registered pids

Unregisters a process from a topic

Link to this section Functions

Link to this function add(server, topic, pid)
add(atom(), binary(), pid()) :: :ok

Registers a pid to a topic.

Once registered, a process will be linked and monitored by the registry. If a listener process is stopped it will automatically be removed.

Example

iex> add(MyApp.Bus, "a_topic", self())
:ok
Link to this function child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function list(server, topic)
list(atom(), binary()) :: [pid()]

Returns a list of registered pids.

Example

iex> list(MyApp.Bus, "a_topic")
[#PID<0.173.0>, #PID<0.174.0>, #PID<0.175.0>]
Link to this function remove(server, topic, pid)
remove(atom(), binary(), pid()) :: :ok

Unregisters a process from a topic.

Example

iex> remove(MyApp.Bus, "a_topic", self())
:ok