Jido. Signal. Instance
(Jido Signal v2.2.1)
View Source
Manages instance-scoped signal infrastructure.
Provides a child_spec for starting instance-scoped supervisors that mirror the global signal infrastructure but are isolated to a specific instance.
Usage
Add to your application's supervision tree:
children = [
# Global signal infrastructure starts automatically via application.ex
# Instance-scoped infrastructure
{Jido.Signal.Instance, name: MyApp.Jido}
]
Supervisor.start_link(children, strategy: :one_for_one)Then use the jido: option to route operations through your instance:
{:ok, bus} = Jido.Signal.Bus.start_link(
name: :my_bus,
jido: MyApp.Jido
)Child Processes
Each instance starts:
- Registry (for managing signal subscriptions)
- TaskSupervisor (for async operations)
- Extension Registry (for signal extensions)
Summary
Functions
Returns a child specification for starting an instance supervisor.
Checks if an instance is running.
Starts an instance supervisor with the given options.
Stops an instance supervisor.
Types
Functions
@spec child_spec([option()]) :: Supervisor.child_spec()
Returns a child specification for starting an instance supervisor.
Options
:name- The instance name (required). This will be used as the prefix for all child process names.:shutdown- Shutdown timeout (default: 5000)
Examples
# In your supervision tree
{Jido.Signal.Instance, name: MyApp.Jido}
# With custom shutdown
{Jido.Signal.Instance, name: MyApp.Jido, shutdown: 10_000}
Checks if an instance is running.
Examples
iex> Jido.Signal.Instance.running?(MyApp.Jido)
true
Starts an instance supervisor with the given options.
Options
:name- The instance name (required)
Returns
{:ok, pid}- Instance supervisor started successfully{:error, reason}- Failed to start
Stops an instance supervisor.
Examples
:ok = Jido.Signal.Instance.stop(MyApp.Jido)