Synapse.SignalRouter (Synapse v0.1.1)
View SourceRuntime wrapper around Jido.Signal.Bus that enforces signal contracts,
centralizes publish/subscribe ergonomics, and enables targeted delivery
to specialists without leaking process identifiers.
Summary
Types
Unique subscription identifier returned by subscribe/3.
Functions
Acknowledges a signal delivery (placeholder hook for future durability).
Dispatches a review request to a specialist identified by registry id.
Returns a specification to start this module under a supervisor.
Fetches router metadata (bus, registry, name) from persistent storage.
Publishes a signal for the given topic after validating the payload.
Replays historical signals for the given topic.
Retries a publish with the provided payload and options.
Starts the router process and its dedicated signal bus.
Subscribes the caller (or provided :target) to a validated topic stream.
Cancels a subscription created via subscribe/3.
Types
@type subscription_id() :: reference()
Unique subscription identifier returned by subscribe/3.
Functions
@spec ack(atom(), Jido.Signal.t()) :: :ok
Acknowledges a signal delivery (placeholder hook for future durability).
@spec cast_to_specialist( atom(), Synapse.AgentRegistry.agent_id(), Jido.Signal.t(), keyword() ) :: :ok | {:error, term()}
Dispatches a review request to a specialist identified by registry id.
Returns a specification to start this module under a supervisor.
See Supervisor.
Fetches router metadata (bus, registry, name) from persistent storage.
@spec publish(atom(), Synapse.Signal.topic(), map(), keyword()) :: {:ok, Jido.Signal.t()} | {:error, term()}
Publishes a signal for the given topic after validating the payload.
Accepted options:
:source- logical source URI (defaults to "/synapse/router"):subject- optional subject string:meta- metadata map merged into the signal struct
@spec replay(atom(), Synapse.Signal.topic(), keyword()) :: {:ok, [Jido.Signal.t()]} | {:error, term()}
Replays historical signals for the given topic.
@spec retry(atom(), Synapse.Signal.topic(), map(), keyword()) :: {:ok, Jido.Signal.t()} | {:error, term()}
Retries a publish with the provided payload and options.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the router process and its dedicated signal bus.
Options:
:name- router identifier (defaults to Synapse.SignalRouter):bus_name- name of the underlyingJido.Signal.Bus:registry-Synapse.AgentRegistryname for targeted delivery helpers:bus_opts- additional options passed toJido.Signal.Bus.start_link/1
@spec subscribe(atom(), Synapse.Signal.topic(), keyword()) :: {:ok, subscription_id()} | {:error, term()}
Subscribes the caller (or provided :target) to a validated topic stream.
@spec unsubscribe(atom(), subscription_id()) :: :ok
Cancels a subscription created via subscribe/3.