I’m new to Temporal, and I appreciate your understanding as I seek some guidance. I’m curious to learn how user tasks are typically implemented in Temporal. Specifically, if a user logs in, how can we retrieve all tasks assigned to that user? Additionally, I’m interested in understanding how to manage operations like candidate task assignment, task reassignment and populating variable data upon task completion. Thanks in advance.
There are no direct human task management capabilities built-in into Temporal.
There are two approaches for this:
- Keep all the tasks assigned to the user in an external DB. Have an activity to insert this task to the DB. Upon task state changes signal workflow about it.
- Create “UserTasks” workflow per user that keeps the user tasks. Then query and update the workflow to see and interact with the tasks.
Thanks for the response
As you mentioned I have created an activity to insert user task to the database. But how can I signal the workflow when the user task is completed?
User invokes an API for task completion and I need to pause the workflow execution until this task is completed. I am quite confused here, could you please provide an example in java for the same
- Use invokes an API
- API implementation signals the workflow
- Signal handler updates a field of a workflow
- Workflow waits for this field to be updated using
Workflow.await
.