# `T3.RPC.WorkQueue`
[🔗](https://github.com/dl-alexandre/t3-elixir/blob/main/lib/t3/rpc/work_queue.ex#L1)

Optional bounded, ordered, in-memory processing for reader chunks.

Supervise this process before the reader. `:work` is a function receiving an
event and returning `:ok`; it runs in an isolated worker. `enqueue/2` returns
immediately after admission, so upstream ACK means accepted in memory, **not**
processed or durable. A crash/kill of this queue can lose accepted work. Use a
durable application queue inside the normal synchronous reader callback when
processing must survive failures.

`:capacity` (default 32) counts the running event plus queued events. A full
queue returns `{:error, :busy}`, which Reader understands for chunk callbacks:
it retains that chunk and withholds its ACK until admission succeeds. Only one
worker runs, preserving admission order. `:work_timeout` defaults to 30 seconds.
Worker failures/timeouts notify the required `:owner` PID or registered process as
`{:t3_work_queue, queue, {:failed, event}}` and processing continues. Handle this
notification explicitly if retries or reconciliation are required. Work is not
retried automatically, because its side effects may already have occurred.

Status output omits work, queued data and callback closures.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `enqueue`

Admit work without waiting for execution, or return `{:error, :busy}`.

# `start_link`

---

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