# `Condukt.Sessions.Resumer`
[🔗](https://github.com/tuist/tuist/blob/condukt@3.0.0/condukt/lib/condukt/sessions/resumer.ex#L1)

Behaviour for starting a session that input was stored for while no node
ran it.

Where a session runs, and how starting one is scheduled, is the host's
policy, separate from where its input is stored (`Condukt.Sessions.Inbox`).
When `Condukt.Sessions.submit/3` has stored an input and finds no session
running under its id, it calls `c:resume/2`. The resumed session takes its
stored input as it starts.

    config :condukt, resumer: {MyApp.SessionResumer, []}

`c:resume/2` runs in the process that submitted the input, so it should
only start the session, or hand that to whatever the host schedules work
with, and return. It may be called while the session is starting, or runs
on a node the registry has not seen yet, so make it idempotent: work that
finds the session already running calls `Condukt.Sessions.drain/1` instead
of starting another.

`Condukt.Sessions.submit/3` also takes a `:resumer` option, which may also be
a function of the session id, for tests and single-node hosts. Without a
resumer, input for a session that is not running waits until something
starts it.

# `resume`

```elixir
@callback resume(session_id :: String.t(), opts :: keyword()) :: :ok
```

Starts the session `session_id`, or schedules that, and returns.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
