# Queue concepts

A Queue separates accepting work from running the handler. `runQueue()` sends
a typed payload to the configured provider and returns when the provider accepts
the message. The handler runs later, often in another process or region.

## Acceptance is not completion

The result from `runQueue()` tells you whether the provider accepted the job.
It does not contain the handler result. Give the job an id or an application
key when you need to show progress, then store the final state in a durable
primitive such as [KV](https://vitehub.dev/docs/kv) or [Database](https://vitehub.dev/docs/database).

## Delivery can happen again

Providers retry failed delivery. Write handlers so a second delivery is safe.
Use an idempotency key before sending an email, charging a card, or changing a
record. See [Queue limits and errors](https://vitehub.dev/docs/queue/limits-and-errors) for
provider limits and failure codes.

The local Vite integration discovers Definitions and generates provider output,
but it does not emulate delivery. Use [Queue hosts](https://vitehub.dev/docs/queue/hosts) and a
build inspection when you need to verify deployment wiring.
