ADK.Session.Recovery (ADK v0.0.1)

Copy Markdown View Source

Recovers active sessions after application restart.

On application boot, scans the configured session store for sessions that were active (not completed/failed) and restarts their GenServer processes under the SessionSupervisor.

Usage

# In your Application.start/2, after starting the supervisor:
ADK.Session.Recovery.recover(store: {ADK.Session.Store.JsonFile, [base_path: "sessions/"]})

# Or with options:
ADK.Session.Recovery.recover(
  store: {ADK.Session.Store.JsonFile, [base_path: "sessions/"]},
  auto_save: true,
  filter: fn session -> session.app_name == "my_app" end
)

Beyond Python ADK: This module has no equivalent in the Python ADK.

Summary

Functions

Scan the session store and restart active sessions.

Functions

recover(opts)

@spec recover(keyword()) :: {:ok, non_neg_integer()} | {:error, term()}

Scan the session store and restart active sessions.

Options:

  • :store{module, opts} tuple for the session store (required)
  • :auto_save — whether recovered sessions auto-save on terminate (default: true)
  • :filter — optional function to filter which sessions to recover
  • :timeout — max time to wait for all recoveries (default: 30_000ms)

Returns {:ok, recovered_count} or {:error, reason}.