sdk-typescript icon indicating copy to clipboard operation
sdk-typescript copied to clipboard

[Feature Request] Session support

Open schickling opened this issue 3 years ago • 4 comments

Would be great if Sessions similar to the Go SDK were supported in TS as well.

schickling avatar Nov 15 '21 17:11 schickling

Here's an alternative:

https://github.com/temporalio/samples-typescript/tree/main/activities-sticky-queues

If anyone has a use case in which this doesn't work well, please post a comment, thanks!

lorensr avatar Nov 08 '22 00:11 lorensr

Note that the main difference between sticky activities and sessions is concurrency control, max concurrent sessions vs to max concurrent activities per worker.

bergundy avatar Nov 08 '22 01:11 bergundy

I took a look at the sticky queue but it's not clear that it matches exactly what I need. In particular, I have two doubts/questions:

  1. I want the worker to be able to listen on multiple queues. The workflow should only be coupled to a particular worker after it has picked up the first task.
  2. If the worker crashes midway through execution, how do I ensure the next worker that spawns for that workflow will start over from the beginning?

morgante avatar Mar 27 '23 00:03 morgante

Sorry for the late response.

  1. I want the worker to be able to listen on multiple queues. The workflow should only be coupled to a particular worker after it has picked up the first task.

A worker only listens on a single task queue but you can start multiple workers in the same process. Coupling the workflow to a worker is shown in the sample posted above.

  1. If the worker crashes midway through execution, how do I ensure the next worker that spawns for that workflow will start over from the beginning?

You'll need to use schedule to start timeout to detect that the worker went away and restart the sequence of activities. This is all part of the sticky activity queues sample.

bergundy avatar Apr 13 '23 00:04 bergundy