Queueing is for work that should not block the user's request. The button returns quickly, and a background process does the heavy job.
Good for backups, exports, report generation, imports, and long AI jobs.
The endpoint records intent and queues the process.
The process performs the slow work outside the request path.
Queue From Endpoint
The endpoint should stay short. It changes the job status to waiting and asks the internal process to run later.
Queue report generation
Service queues process
Run In Process
The internal process owns the slow work. It can update progress, upload files, and mark the job as done or failed.
Internal process
Slow job
Replica Roles
Akan can run replicated children with roles. `federation` handles user-facing requests, while `batch` can take background work. This helps prevent slow jobs from exhausting the request server.
Before batch child
After batch child
Tips
Always store job status: `waiting`, `running`, `done`, `failed`.
Make jobs idempotent. Retrying the same job should not corrupt data.
Save progress when the user needs feedback.
Return quickly from endpoint. Do the slow work in process.