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-dev
to start Temporal Server.- Make sure you have installed Redis and started Redis locally on the default port 6379
npm install
to install dependencies.npm run start.watch
to start the Worker.- In another shell,
npm run subscribe
to run the Workflow.
The Workflow should return:
0
10
20
30
40
50
60
70
80
90
100