Skip to content

Commit 2f39146

Browse files
committed
samples: workflow_streams: drop BFF jargon and Expected output block
Two README/comment cleanups: * "BFF" (backend-for-frontend) is not a widely-known term outside certain front-end-architecture circles. Replace with the more obvious "web backends" in the README intro and "production web backend" in the run_reconnecting_subscriber.py comment about where the resume offset would live durably. * Drop the "Expected output" section. It only covered scenarios 1 and 2; with five scenarios it is no longer pulling its weight. Anyone running the script can see the output for themselves.
1 parent 51f2f2d commit 2f39146

2 files changed

Lines changed: 5 additions & 41 deletions

File tree

workflow_streams/README.md

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
`temporalio.contrib.workflow_streams` lets a workflow host a durable,
99
offset-addressed event channel. The workflow holds an append-only log;
10-
external clients (activities, starters, BFFs) publish to topics via
10+
external clients (activities, starters, web backends) publish to topics via
1111
signals and subscribe via long-poll updates. This packages the
1212
boilerplate — batching, offset tracking, topic filtering,
1313
continue-as-new hand-off — into a reusable stream.
@@ -118,40 +118,3 @@ To exercise scenario 5's retry path, kill `run_llm_worker.py`
118118
activity's next attempt sends a `RetryEvent` first; the consumer
119119
clears its on-screen output via ANSI escapes and re-renders from
120120
scratch.
121-
122-
## Expected output
123-
124-
Scenario 1 (basic publisher):
125-
126-
```
127-
[status] received: order=order-1
128-
[progress] charging card...
129-
[progress] card charged
130-
[status] shipped: order=order-1
131-
[progress] charge id: charge-order-1
132-
[status] complete: order=order-1
133-
workflow result: charge-order-1
134-
```
135-
136-
Scenario 2 (reconnecting subscriber). Each line carries a stats
137-
column on the left (`proc`, `avail`, `pend`) and a phase / event
138-
message on the right; a background poller emits a `·` heartbeat
139-
once a second. Offsets are continuous across the disconnect — no
140-
events lost, none duplicated:
141-
142-
```
143-
proc= 0 avail= 0 pend= 0 │ started workflow-stream-pipeline-...
144-
proc= 0 avail= 1 pend= 1 │ [phase 1] connecting
145-
proc= 1 avail= 1 pend= 0 │ offset= 0 stage=validating
146-
proc= 2 avail= 2 pend= 0 │ offset= 1 stage=loading data
147-
proc= 2 avail= 2 pend= 0 │ [phase 1] disconnecting
148-
proc= 2 avail= 3 pend= 1 │ ·
149-
proc= 2 avail= 3 pend= 1 │ ·
150-
proc= 2 avail= 4 pend= 2 │ ·
151-
proc= 2 avail= 4 pend= 2 │ [phase 2] reconnecting
152-
proc= 3 avail= 4 pend= 1 │ offset= 2 stage=transforming
153-
proc= 4 avail= 4 pend= 0 │ offset= 3 stage=writing output
154-
proc= 5 avail= 5 pend= 0 │ offset= 4 stage=verifying
155-
proc= 6 avail= 6 pend= 0 │ offset= 5 stage=complete
156-
proc= 6 avail= 6 pend= 0 │ workflow result: pipeline ... done
157-
```

workflow_streams/run_reconnecting_subscriber.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ async def main() -> None:
8686
task_queue=TASK_QUEUE,
8787
)
8888

89-
# In a real BFF the resume offset lives in durable storage keyed by
90-
# (user_id, run_id) — a database row, a Redis key, etc. For an
91-
# in-process demo a State.processed attribute works the same way.
89+
# In a production web backend the resume offset would live in
90+
# durable storage keyed by (user_id, run_id) — a database row, a
91+
# Redis key, etc. For an in-process demo a State.processed
92+
# attribute works the same way.
9293
state = State()
9394
stream = WorkflowStreamClient.create(client, workflow_id)
9495
emit(state, f"started {workflow_id}")

0 commit comments

Comments
 (0)