Commanded v0.19.1 Commanded.PubSub.LocalPubSub View Source

Local pub/sub adapter, restricted to a single node, using Elixir's Registry module.

You can configure this adapter in your environment config file:

# `config/config.exs`
config :commanded, pubsub: :local

This adapter will be used by default when none is specified in config.

Link to this section Summary

Functions

Broadcasts message on given topic.

Start a Registry for local pub/sub.

List tracked terms and associated PIDs for a given topic.

Subscribes the caller to the topic.

Track the current process under the given topic, uniquely identified by key.

Link to this section Functions

Link to this function

broadcast(topic, message)

View Source
broadcast(String.t(), term()) :: :ok | {:error, term()}

Broadcasts message on given topic.

Start a Registry for local pub/sub.

Link to this function

list(topic)

View Source
list(String.t()) :: [{term(), pid()}]

List tracked terms and associated PIDs for a given topic.

Link to this function

subscribe(topic)

View Source
subscribe(String.t()) :: :ok | {:error, term()}

Subscribes the caller to the topic.

Link to this function

track(topic, key)

View Source
track(String.t(), term()) :: :ok

Track the current process under the given topic, uniquely identified by key.