Synchronized activity /queue

Is there a way i can create an activity which is synchronized in nature?
i.e. multiple workflows could call an activiely but only one of them will execute it at a give time…

Or is there a way i can create a special taks queue which ensures that only one task is processed at a time. ?

My use case is 1000s of workflow does many things, there are few critical part , which only one workflow should get access to at a time… is there a way I can achieve this using some kind of special activity/activity option or queue?

my requirement may be very similar to Implementing a Rate Limiter Service for Workflow Activities

But i dont really want the workflow to be aware of the rate limiter etc…
i want to leverage temporal activity/queue defination which lets only set number of concurrent tasks across the cluster…

You have a couple of options:

  1. Create a dedicated task queue for that activity and have a single worker to consume it. Also set the worker’s MaxConcurrentActivityExecutionSize to 1. Obviously, this is not great for HA.

  2. Use a distributed lock, e.g. Distributed Locks with Redis | Redis

1 Like