Temporal is a durable workflow orchestration platform used at scale. These exercises cover Temporal's key concepts: signals for async communication, queries for state inspection, child workflows, durable scheduling, and safe workflow versioning.
0 / 5 completed
1 / 5
At standup, a colleague asks what Signals are in Temporal. What is the correct answer?
Signals in Temporal are asynchronous messages delivered to a running workflow. You define signal handlers with wf.setHandler(mySignal, handler), and external code sends them via the Temporal client. Signals can update workflow state, add items to a queue, or unblock a wf.condition() that the workflow is waiting on. Unlike queries, signals are durable and trigger state changes — they do not return values.
2 / 5
During a PR review, a teammate asks what Queries in Temporal are and how they differ from Signals. Which answer is correct?
Queries are synchronous, read-only operations. You register a query handler with wf.setHandler(myQuery, () => currentState) and call it externally via the Temporal client. The caller receives the current state value immediately. Crucially, query handlers must not modify workflow state — they are pure reads. This contrasts with Signals, which are asynchronous and can trigger state changes.
3 / 5
In a design review, the team discusses child workflows in Temporal. A junior engineer asks when to use a child workflow instead of an Activity. What is correct?
Child workflows are appropriate for units of work that need their own independent history, signal handlers, or that represent a significant sub-process with multiple steps. They appear as separate workflows in the Temporal UI and can be cancelled or signalled independently. Activities are better for single, atomic operations — an API call, a file upload, a database write — that don't need their own workflow history or the ability to receive signals.
4 / 5
An incident report shows a deployed workflow breaking after a code change that altered the sequence of awaited calls. A senior engineer asks what workflow versioning is for. What is correct?
Temporal replays workflow history by re-executing workflow code — so the code must produce the same sequence of commands (determinism). If you change the order of awaited calls, running workflows will fail replay with a non-determinism error. Workflow versioning (wf.patched('my-change-id')) lets you branch: old runs take the old code path, new runs take the new path. This allows safe rollout of breaking changes to workflow logic.
5 / 5
During a code review, a senior engineer asks what Schedules in Temporal provide that a simple cron job does not. What is accurate?
Temporal Schedules go far beyond cron. They offer configurable overlap policies (skip a run if previous is still going, buffer it, or terminate the previous), backfill for missed intervals, jitter to spread load, and the ability to pause/resume without code changes. All scheduled runs are visible in the Temporal UI with full history. A system cron has none of this observability or control and offers no durability guarantees.