Demo using Redis Streams, Immer, and SDK Interceptors to build a subscribable query mechanism for Workflow state.
This is an advanced sample that requires knowledge of SDK internals. There's a lot going on "behind the scenes" in subscriptions.ts.
It is far simpler to manually publish updates from Workflow code but we put the sample here to show off some of the advanced capabilities provided by the runtime.
temporal server start-devto start Temporal Server.- Make sure you have installed Redis and started Redis locally on the default port 6379
npm installto install dependencies.npm run start.watchto start the Worker.- In another shell,
npm run subscribeto run the Workflow.
The Workflow should return:
0
10
20
30
40
50
60
70
80
90
100