Skip to main content
DocumentationTyped worker

Examples

Typed worker

Implement an idempotent TypeScript worker with typed payloads and explicit settlement.

Arc Runtime 3.xUpdated Jul 18, 2026

Create the worker

src/worker.ts
import { worker } from "@arcwell/atlas";
import { orderAccepted } from "./events";

export const fulfillment = worker(
  "northline-fulfillment",
  orderAccepted,
  async ({ event, settle }) => {
    await reserveInventory(event.payload.orderId, {
      idempotencyKey: event.id,
    });

    await settle();
  }
);

Handle failures

Allow unexpected errors to escape the handler. Atlas releases the lease and Arc Runtime applies the stream retry policy.

Run locally

shell
arcctl dev --worker src/worker.ts
On this page
  1. Create the worker
  2. Handle failures
  3. Run locally