Temporal has become the standard for building reliable distributed applications. It provides durable execution guarantees, making it easy to build fault-tolerant workflows.
Core Concepts
- Workflows: Long-running, durable functions
- Activities: Short-lived tasks that can fail
- Workers: Processes that execute workflows
- Signals: External input to running workflows
Building a Workflow
// workflows.ts
import { proxyActivities } from "@temporalio/workflow";
import type * as activities from "./activities";
const { sendEmail, chargePayment, fulfillOrder } = proxyActivities<typeof activities>({
startToCloseTimeout: "1 minute",
retry: { maximumAttempts: 3 },
});
export async function orderWorkflow(order: Order): Promise<void> {
await chargePayment(order.paymentDetails);
await sendEmail(order.customerEmail, "Payment confirmed");
await fulfillOrder(order.id);
await sendEmail(order.customerEmail, "Order shipped");
}
Why Temporal?
- Automatic retries with exponential backoff
- Workflow state persisted automatically
- Survives process crashes and restarts
- Built-in visibility and debugging
Comments (0)
Leave a Comment
No comments yet. Be the first to share your thoughts!