Skip to content

Latest commit

 

History

History

query-subscriptions

Query Subscriptions

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.

Running this sample

  1. temporal server start-dev to start Temporal Server.
  2. Make sure you have installed Redis and started Redis locally on the default port 6379
  3. npm install to install dependencies.
  4. npm run start.watch to start the Worker.
  5. 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