worker

command
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Command worker is the FRAMEWORK-MODE outbox consumer for the backend-guide example — the other half of the async story in docs/BACKEND_SPEC_LLM.md §6.

The engine's `Ctx.Enqueue(topic, payload)` writes a job in your handler's transaction (so the job exists if and only if the business write committed) and fires a notify on commit. THIS process drains it. It is a SEPARATE binary from the engine on purpose: a slow or crashing consumer must never hold a request open, pin a pool connection, or take the API down with it.

You do not need the shipped `appximo-worker` binary to do this — pkg/worker is a library, and a consumer is ~40 lines:

DATABASE_URL=... go run ./examples/backend-guide/worker

Scale it by running N IDENTICAL copies: the drain uses `SELECT … FOR UPDATE SKIP LOCKED`, so instances never collide on a row.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL