Commanded.PubSub.Adapter behaviour (Commanded v1.3.1) View Source
Pub/sub behaviour for use by Commanded to subcribe to and broadcast messages.
Link to this section Summary
Callbacks
Broadcasts message on given topic.
Return an optional supervisor spec for pub/sub.
List tracked PIDs for a given topic.
Subscribes the caller to the PubSub adapter's topic.
Track the current process under the given topic
, uniquely identified by
key
.
Link to this section Types
Specs
adapter_meta() :: map()
Specs
application() :: Commanded.Application.t()
Link to this section Callbacks
Specs
broadcast(adapter_meta(), topic :: String.t(), message :: term()) :: :ok | {:error, term()}
Broadcasts message on given topic.
topic
- The topic to broadcast to, ie:"users:123"
message
- The payload of the broadcast
Specs
child_spec(application(), config :: Keyword.t()) :: {:ok, [:supervisor.child_spec() | {module(), term()} | module()], adapter_meta()}
Return an optional supervisor spec for pub/sub.
Specs
list(adapter_meta(), topic :: String.t()) :: [{term(), pid()}]
List tracked PIDs for a given topic.
Specs
subscribe(adapter_meta(), topic :: String.t()) :: :ok | {:error, term()}
Subscribes the caller to the PubSub adapter's topic.
Specs
track(adapter_meta(), topic :: String.t(), key :: term()) :: :ok | {:error, term()}
Track the current process under the given topic
, uniquely identified by
key
.