Build durable workflows with activities, signals, queries, workflow versioning, and understand how workers poll task queues for fault-tolerant orchestration.
0 / 5 completed
1 / 5
What is a Temporal workflow and what property makes it fault-tolerant?
Temporal workflow: the Temporal server persists every event (activity scheduled, completed, timer fired, signal received) to the event history. On recovery, the workflow code replays deterministically — the same code path executes, but activity results come from history instead of re-executing. This makes long-running workflows (hours, days, months) resilient to worker restarts and infrastructure failures.
2 / 5
What is a Temporal activity and how does it differ from workflow code?
Activities: workflows are replayed and must be deterministic — no random numbers, no system time calls, no direct I/O. All side effects go into activities. Activities can be retried independently (RetryPolicy), run on specialised workers (GPU, specific region), and report progress via heartbeats. A failed activity is retried without re-running the entire workflow.
3 / 5
What is a Temporal signal and how does it differ from a query?
Signal vs query: a workflow waiting for human approval blocks on a channel until a signal arrives: approvalCh.Receive(ctx, &data). The approval UI sends a signal when the manager clicks "Approve." A query (workflow.SetQueryHandler("getStatus", func() string { return status })) lets dashboards read current state without affecting execution. Both work even if the worker handling the workflow is temporarily unavailable.
4 / 5
What is workflow versioning in Temporal and why is it necessary?
Workflow versioning: because workflows replay their event history deterministically, changing the code path would cause replay failures for in-flight workflows. GetVersion inserts a versioned branch point into the event history — old executions replay through DefaultVersion logic, new executions through version 1 logic. Old workflow definitions can be removed once all old executions complete.
5 / 5
What does a Temporal worker do and how does it relate to task queues?
Temporal worker:worker.New(client, "my-task-queue", worker.Options{}) registers workflow and activity implementations. The Temporal server dispatches tasks to any worker polling the matching task queue. Scaling is as simple as adding more worker processes. Specialised task queues route GPU-intensive activities to GPU workers, while general workflows run on standard workers.