Repository navigation
Show in the five workflow SDK quickstarts that a workflow continues after a restart - #1395
Open
nelson-parente wants to merge 11 commits into
Open
nelson-parente wants to merge 11 commits into
nelson-parente wants to merge 11 commits into
Conversation
This was referenced Oct 29, 2026
Show on the workflow quickstart page that a workflow continues after the app restarts
dapr/docs#5456
Draft
…ives a restart
The order is now 2 cars at 5,000 each, so the workflow waits for approval.
The app uses ORDER_ID (or order-<yyyymmdd-hhmmss>) as the instance ID. It
attaches to an instance that is still running, schedules a new one when none
exists, and prints the status when the instance ended. The inventory is
written only when the key is absent. The approval event is named
ApprovalEvent, takes {"approved": true|false}, and times out after 10 minutes.
The README now stops the app, starts it again, and approves the order.
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ickstart The order processor now orders two cars at 5000 each. The total is over 5000, so the workflow waits for ApprovalEvent (timeout 10 minutes). The app reads ORDER_ID as the workflow instance ID. It schedules the instance when it does not exist, waits for it when it is running, and prints its status when it ended. It seeds the inventory only when the key is absent, so a restart does not add stock again. The approval handler accepts a JSON object or a JSON string, because the Dapr CLI sends the --input value as a JSON string. The README shows how to stop the app, start it again, approve the order with dapr workflow raise-event, and see the workflow continue. The same steps are in the run without Docker section. Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The order is now 2 cars at 5000 each, so it waits for an approval. The app reads ORDER_ID as the workflow instance ID, attaches to an instance that is still running, and writes the inventory only when it is not in the store. The approval wait is 10 minutes, and the approval event accepts a JSON object or a JSON string that holds the object. The README stops the app during the wait, starts it again, and approves the order with the Dapr CLI. Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The order-processor app now reads the order ID from ORDER_ID, places an order of 2 cars at 5000 each, and waits for the ApprovalEvent event for up to 10 minutes. A second start of the app finds the instance that is running and waits for it instead of scheduling a new one. The app writes the inventory only when the key is absent. The workflow function does not log. The approval activity prints the line that shows it ran. The approval payload accepts a JSON object and a JSON string that holds the object, which is what the Dapr CLI sends. The README walks through stop, restart and approve. Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…resume The Go workflow quickstart now orders 2 cars at 5000 each, so the workflow waits for the ApprovalEvent event. The app reads the instance ID from ORDER_ID, attaches to an instance that is still running, and writes the starting inventory only when it is not in the state store. The workflow logs only from activities, and the README steps stop the app, start it again, and approve the order with `dapr workflow raise-event`. Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…idecar starts
Right after the sidecar starts, the workflow runtime of the sidecar can
answer a call with UNAVAILABLE ("actor runtime is closed"). The first
getInstanceState call of the app, which checks whether the order exists,
failed with that error and ended the app.
Retry the call every second for up to 60 seconds while the status is
UNAVAILABLE. Any other error is thrown at once.
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…EADMEs
Write the approve step the same way in the Python, JavaScript, .NET, Java
and Go READMEs: `dapr workflow raise-event $ORDER_ID/ApprovalEvent
--app-id order-processor --input '{"approved": true}'`. The text before the
command tells the reader to set ORDER_ID, in the second terminal, to the
order ID that the app printed. The approve STEP block sets ORDER_ID to
order-validate, so mechanical-markdown runs the same command that the
reader runs.
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nelson-parente
force-pushed
the
workflow-quickstart-durability
branch
from
November 6, 2026 11:33
d3e6930 to
af390b3
Compare
nelson-parente
marked this pull request as ready for review
November 6, 2026 11:33
JoshVanL
previously approved these changes
Nov 6, 2026
…proval The console app now uses runOrder, which waits for approval and resumes after a restart. The Express and DaprServer entry points still use processOrder, which runs one order of 1 car (total 5000). That total is not over the approval threshold, so the HTTP call returns without an approval step. The README said that both entry points share the console app's order lifecycle. That is no longer true, so the README and a comment on processOrder now describe the difference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Resolve the conflicts with dapr#1394 in the Go, Java and Python SDK READMEs. This branch replaces the run steps, the expected output and the "What happened" list with the stop, restart and approve flow, so the conflicting hunks keep this branch. The other dapr#1394 changes in these files stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LWoz3gpTsSSL3KbxrLqcW1 Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request does not need #1394. Both change the same parts of the Go, Java and Python READMEs, so the one that merges second needs a rebase.
Each workflow SDK quickstart now shows in the first run that a workflow keeps its progress when the app stops.
Changes
The behavior is the same in Python, JavaScript, .NET, Java and Go:
ApprovalEvent.ORDER_IDas the workflow instance ID. Without it, the ID isorder-<yyyymmdd-hhmmss>.dapr workflow raise-event --inputsends the string form.UNAVAILABLE.dapr workflow raise-event $ORDER_ID/ApprovalEvent --app-id order-processor --input '{"approved": true}'.Tests
The README steps ran in a container with Dapr 1.19.0, Redis, Placement and Scheduler. A run passed when the instance reached
COMPLETED.mm.py -l README.md(mechanical-markdown) passes for the five READMEs on Redis.🤖 Generated with Claude Code