Skip to main content

Workflow Message Passing - Interactive Demo

What is Workflow Message Passing?

You've started a long-running Workflow. It's running. Now what? How do you check on its progress? How do you tell it something changed? How do you get a value out of it?

The core idea in one sentence

You define named handlers on your Workflow for three types of messages: Signals (push a notification in), Queries (read state out), and Updates (change state and get a result back). Your client calls them by name on a Workflow handle, and the running Workflow reacts.

A concrete way to see it

Say you have a chef cooking a multi-course meal. The meal is in progress and the chef keeps working, but the rest of the restaurant still needs to reach them:

Signal

A waiter tells the chef "Table six would like more bread." The chef notes it and keeps cooking. No reply needed. The waiter moves on.

Query

A manager asks "How many courses have gone out?" The chef checks the board and answers without stopping work.

Update

A customer asks "Can you add a dessert?" The chef checks if there's still time. If yes: "Added." If no: "The order is already closed." The customer waits for that answer before leaving the table.

The three types, side by side

TypeLike saying...Gets a response?Can change state?
Signal"Hey, FYI"NoYes
Query"What's the current status?"Yes (read-only)No
Update"Please change X and confirm it"Yes (result or rejection)Yes

What it looks like in code

Your client code
C
Order Service
sends messages to the Workflow
handle.signal(approve)
handle.query(get_status)
handle.execute_update(set_priority, 3)
Temporal Server
Routes · Persists · Delivers
Your Workflow
W
OrderWorkflow
running, waiting for messages
@workflow.signal approve()
@workflow.query get_status()
@workflow.update set_priority()