Built from performers and enqueue
You define the job handler as a performer and call enqueue where you submit the job. Tsumugi handles delivery, execution, and state tracking.
Using Cloudflare Queues directly as a job queue causes several problems.
01
02
concurrencyKey run one at a time, in order.03
04
You write code in only two places: the job handler and the enqueue call.
1 Define the job handler as a performer
import { Performer } from 'tsumugi/performer';export class SendMail extends Performer<{ to: string }, void, {}, Env> { async perform(payload: { to: string }): Promise<void> { await this.env.MAILER.send(payload.to); }}2 Enqueue a job
import { defineTsumugi } from 'tsumugi';import { SendMail } from './performers/send-mail.js';const tsumugi = defineTsumugi({ performers: { SendMail } });const id = await tsumugi.enqueue(env, { binding: 'SendMail', payload: { to: 'a@example.com' } });You define the job handler as a performer and call enqueue where you submit the job. Tsumugi handles delivery, execution, and state tracking.
Retries, backoff, delayed jobs, scheduled jobs, priority, concurrency and rate limits, deduplication, and a dashboard are standard features of Tsumugi.
The dashboard and REST API list and search every job, including succeeded and failed ones. With the TSUMUGI_METRICS binding configured, Tsumugi also records failure rate and duration metrics.

Declare nodes and their dependencies, and each node's return value is passed to the next node as its payload. With fan-out, a child node is created for each element of an array and runs in parallel.
Calling enqueue(env, { binding, payload }) enqueues a job. The call returns the job ID and completes immediately.
A job with guarantee set to at-most-once never runs twice. The default guarantee is at-least-once.
Tsumugi runs performers even when they live in another Worker connected through a Service Binding.

