Human dependent long running Workflows

Not sure if this has been discussed before, I did a search in the forums and so far haven’t found exactly what I was looking for.
But I am trying to find best practices for creating Human dependent long running workflows and specifically How I would represent things like task/approval queues, where users see a task in their queue, they select it, assign it to themselves or someone else, They do what they need to do, add data to the request etc, and then submit and update the workflow at which point it gets to the next step.
Sorry for the question, temporal and other Workflow orchestrators are new to me so I am trying to get down the patterns and best practices.

So I guess I should explain what I think I understand so far. So in Temporal I would define what steps would happen when in a Workflow. In that workflow I would define various activities for non-deterministic executions like API calls, IO operations (writing files etc).

I would query the state of the workflow using queries, I would update the state of the workflow using Signals.

I am trying to map that to what I understand queues would be. Imagine if I had a process where I was an approver of some sort of request. And when I approved I sent it up to my boss to get his approval.
And I could have a stack of approvals in my quote un quote queue?

I think in the Ecommerce application example that would be represented by multiple instances of the workflow all waiting on input at a certain step correct? Or would that be represented by tasks in the task queue?

Again sorry for the question still wrapping my head around these concepts. Thanks again!

I think your requirements are similar to those asked in this forum question.
Yes your thinking is correct as in having an activity that updates an external system responsible for interacting with the human actor, and then use signals to notify the workflow of the completion of the human decision.

Note that with temporal you can write your code to wait for multiple signals, in the case where you might require decisions from multiple human actors in order to move forward with the next activity. This post has some code samples that show off how to do it completely async.

You can think of task queues as “endpoints” on the temporal server. Your workers listen to those endpoints waiting to pick up tasks and use the task info to process /continue processing your workflow executions.

Let us know if you have any further questions / concerns.

1 Like

Adding to @tihomir answer. You can store the list of task assigned to a human in an external system. Another option is to have a workflow instance per approver. And keep the list of assigned tasks in those approver workflows.

1 Like

Thanks @tihomir and @maxim. Im putting together a little UI with a little workflow beneath it as a proof of concept to see if this solution is right for the problem I am trying to solve. And so far its looking that way. I appreciate you answering my questions on best practices.