ACPex.Protocol.ConnectionSupervisor (ACPex v0.1.1)

Copy Markdown View Source

DynamicSupervisor that manages all active ACP connections.

This is the top-level supervisor for all connection processes in the ACPex application. It provides:

  • Dynamic creation of agent and client connections
  • Fault isolation between different connections
  • Named process for easy access throughout the application

Supervision Tree

ACPex.Application
 ConnectionSupervisor
     Connection (agent_1)
        SessionSupervisor
            Session
            ...
     Connection (client_1)
        SessionSupervisor
            ...
     ...

Usage

The ConnectionSupervisor is automatically started by ACPex.Application. Connections are created via ACPex.start_agent/3 or ACPex.start_client/3, which internally call start_connection/1.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a new connection under this supervisor.

Starts the ConnectionSupervisor.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_connection(opts)

@spec start_connection(keyword()) :: DynamicSupervisor.on_start_child()

Starts a new connection under this supervisor.

Options

See ACPex.Protocol.Connection.start_link/1 for available options.

Examples

ConnectionSupervisor.start_connection(
  handler_module: MyAgent,
  handler_args: [],
  role: :agent
)

start_link(init_arg)

@spec start_link(term()) :: Supervisor.on_start()

Starts the ConnectionSupervisor.

This is typically called automatically by ACPex.Application during application startup.