NexusMCP.SessionRegistry behaviour (NexusMCP v0.3.0)

Copy Markdown View Source

Behaviour for session registry implementations.

The default implementation (NexusMCP.SessionRegistry.Local) wraps Elixir's built-in Registry for single-node usage.

For multi-node deployments, implement this behaviour with :global, :pg, Horde, or your preferred distributed registry.

Configuration

config :nexus_mcp, registry: MyApp.DistributedRegistry

Summary

Functions

Returns the configured registry module.

Callbacks

lookup(session_id)

@callback lookup(session_id :: String.t()) :: {:ok, pid()} | :error

register(session_id, pid)

@callback register(session_id :: String.t(), pid()) :: :ok | {:error, :already_registered}

unregister(session_id)

@callback unregister(session_id :: String.t()) :: :ok

Functions

impl()

Returns the configured registry module.