Fan-Out
Dispatch child tasks from within a handler using ctx.task(). Each child runs as an independent execution with its own retry policy, timeout, and logging.
Quick Example
import { task } from "@usepingback/next";
export const processOrder = task("process-order", async (ctx) => {
const { orderId, items, userId } = ctx.payload as {
orderId: string;
items: string[];
userId: string;
};
// Fan out to independent child tasks
ctx.task("send-confirmation", { orderId, userId });
ctx.task("update-inventory", { items });
ctx.task("notify-warehouse", { orderId, items });
});How It Works
- Inside a handler, call
ctx.task(name, payload)one or more times. - Task requests are collected in memory (not dispatched immediately).
- When the handler completes, the SDK returns the collected tasks in the response body.
- The platform creates a child execution for each task, linked to the parent via
parentId. - Each child is dispatched to the job queue independently.
- Child executions appear nested under the parent in the dashboard.
Limitations
- Fan-out tasks are dispatched after the parent handler completes, not during.
- The number of child tasks per execution may be capped by your plan (e.g. 10 for Pro).
- Child tasks inherit no state from the parent — all data must be passed via the payload.
Workflows
Fan-out enables multi-step workflows by chaining tasks. Each task can dispatch further tasks, creating a directed graph of executions. The dashboard visualizes the full workflow graph with parent-child relationships.