Limit workflow-based concurrent executions?

Hi, I am looking for a way to limit the concurrent amount of a type of workflow.
This often is because the executing workflow code must work based on some kind of semaphore.

There is not server side support for this feature. We have plans to add such support in the future, but currently you have to implement it in the application code.

What is the use case? Such limitation is very rarely needed.

Hi Maxim, my workflow uses activities to instrument an external service that can only process 1 task concurrently.

For such a use case, I would use a mutex workflow. The basic idea that for each such resource exists a single workflow execution that invokes that activity. All other workflows send signals to this workflow to request the activity execution. The mutex workflow upon receiving a signal invokes the activity or buffers it until the previous execution is done.

Here is a sample of such a workflow.