Examples
Typed worker
Implement an idempotent TypeScript worker with typed payloads and explicit settlement.
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