Jido.Messaging.Dispatch (Jido Messaging v1.1.0)

Copy Markdown View Source

Dispatches Jido.Messaging signals through Jido Signal primitives.

The canonical path is Jido.Signal.Dispatch to the instance Signal Bus. A legacy room PubSub mirror is still supported for older LiveView/demo code, but new code should subscribe to Signal Bus paths such as "jido.messaging.room.**".

Summary

Functions

Emits a messaging signal to telemetry, the instance Signal Bus, and the optional legacy PubSub mirror.

Subscribes a process to an instance Signal Bus path such as "jido.messaging.room.**".

Removes a Signal Bus subscription created by subscribe/3.

Types

emit_opts()

@type emit_opts() :: [
  telemetry_event: [atom()] | nil,
  telemetry_metadata: map(),
  telemetry_measurements: map(),
  room_id: String.t() | nil,
  legacy_event: term() | nil
]

Functions

emit(instance_module, signal, opts \\ [])

@spec emit(module() | nil, Jido.Signal.t(), emit_opts()) ::
  {:ok, Jido.Signal.t()} | {:error, term()}

Emits a messaging signal to telemetry, the instance Signal Bus, and the optional legacy PubSub mirror.

subscribe(instance_module, path, opts \\ [])

@spec subscribe(module(), String.t(), keyword()) ::
  {:ok, Jido.Signal.Bus.subscription_id()} | {:error, term()}

Subscribes a process to an instance Signal Bus path such as "jido.messaging.room.**".

unsubscribe(instance_module, subscription_id, opts \\ [])

@spec unsubscribe(module(), Jido.Signal.Bus.subscription_id(), keyword()) ::
  :ok | {:error, term()}

Removes a Signal Bus subscription created by subscribe/3.