# `Mailglass.Outbound.AsyncAdapter`
[🔗](https://github.com/szTheory/mailglass/blob/v2.7.0/lib/mailglass/outbound/async_adapter.ex#L1)

Internal behaviour for non-durable asynchronous dispatch.

Dispatch returns `{:ok, pid()}` or `:ok` only after work admission succeeds.
A refusal is returned as `{:error, reason}` and callers must project that
failure instead of acknowledging queued work.

# `dispatch`

```elixir
@callback dispatch(fun :: (-&gt; any()), opts :: keyword()) ::
  {:ok, pid()} | :ok | {:error, term()}
```

# `dispatch`

```elixir
@spec dispatch(
  (-&gt; any()),
  keyword()
) :: {:ok, pid()} | :ok | {:error, term()}
```

Dispatches `fun` via the configured async adapter impl.

The caller is responsible for stamping tenant context inside the closure
via `Mailglass.Tenancy.with_tenant/2` before calling this function — the
tenancy re-stamp works for both impls (-15):

- `TaskSupervisor`: spawns a fresh process; `with_tenant/2` stamps it.
- `Inline`: runs synchronously in the caller's process; `with_tenant/2`
  re-stamps and restores on return.

---

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