Documentation
¶
Overview ¶
Example 15 — Propagate HTTP request cancellation into a workflow.
Demonstrates:
- Running a workflow inside an http.Handler with `WithCallerContext`
- The workflow's per-run context is cancelled when the client disconnects (or the request times out)
- h.GetResult returns context.Canceled so the handler can decide how to respond
- The workflow row is recorded as CANCELLED, not ERROR
This is the request-scoped pattern. Use it when the workflow should stop work the moment the caller goes away. For background work that must outlive the request, drop WithCallerContext and rely on the usual durable-recovery flow instead.
Run: go run .
Click to show internal directories.
Click to hide internal directories.