feat: add IUserTaskService with optional ActivityInstanceId (#4535)#7763
Open
pavankadabala-png wants to merge 2 commits into
Open
feat: add IUserTaskService with optional ActivityInstanceId (#4535)#7763pavankadabala-png wants to merge 2 commits into
pavankadabala-png wants to merge 2 commits into
Conversation
…kflows#4535) Adds a high-level IUserTaskService for triggering user actions against suspended RunTask activities without requiring callers to know the internal TaskId generated at dispatch time. New types: - TriggerUserAction record (Action, WorkflowInstanceId?, ActivityInstanceId?, CorrelationId?) — mirrors the record requested in the issue, using ActivityInstanceId to match Elsa 3 conventions. - IUserTaskService interface — two methods: ExecuteUserActionAsync (synchronous, via IWorkflowResumer) DispatchUserActionAsync (asynchronous, via IBookmarkQueue) - UserTaskService implementation — builds a BookmarkFilter from the TriggerUserAction fields and delegates to the appropriate resumer. The ActivityInstanceId field specifically solves the Fork scenario described in the issue: when multiple RunTask activities in parallel branches share the same TaskName, supplying ActivityInstanceId ensures only the intended branch is resumed. DI registration added alongside ITaskReporter in WorkflowRuntimeFeature. Closes elsa-workflows#4535
Contributor
|
PR author is not in the allowed authors list. |
Author
|
@dotnet-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a high-level
IUserTaskServicefor triggering user actions against suspendedRunTaskactivities, targeting them by workflow identity instead of the internalTaskId.Today the only entry point is the low-level
ITaskReporter.ReportCompletionAsync(taskId, ...), which requires the caller to already know theTaskIdgenerated at dispatch time. This PR complements it with a service that lets callers target a task by workflow-instance ID, activity-instance ID, or correlation ID.Why
Closes #4535. The
ActivityInstanceIdfield solves the Fork scenario raised in the issue: when several parallel branches each contain aRunTaskwith the same task name, the caller otherwise can't say which branch to resume. SupplyingActivityInstanceIddisambiguates it.Changes
TriggerUserAction(record) —Action, optionalWorkflowInstanceId,ActivityInstanceId,CorrelationId.IUserTaskService—ExecuteUserActionAsync(synchronous resume viaIWorkflowResumer) andDispatchUserActionAsync(async enqueue viaIBookmarkQueue).UserTaskService— builds aBookmarkFilterfrom theTriggerUserActionfields and delegates to the appropriate resumer/queue.ITaskReporterinWorkflowRuntimeFeature.Notes
ActivityTypeNameHelper.GenerateTypeName<RunTask>()).ITaskReporteroverloads instead if that's preferred — see discussion on IUserTaskService enhancement - optional activityId #4535.