Add 'Noop' method to WorkflowExecutionContext
A Noop method has been added to the WorkflowExecutionContext, and is now assigned to the ExecuteDelegate field when no resumption point is specified. The change, will prevent the invocation of the regular "ExecuteAsync" method, closing the activity without additional operations.
This commit is contained in:
parent
8ceb76ddbe
commit
a9ccd4fac8
|
|
@ -33,6 +33,7 @@ public class WorkflowExecutionContext : IExecutionContext
|
|||
private static readonly object ActivityOutputRegistryKey = new();
|
||||
private static readonly object LastActivityResultKey = new();
|
||||
internal static ValueTask Complete(ActivityExecutionContext context) => context.CompleteActivityAsync();
|
||||
internal static ValueTask Noop(ActivityExecutionContext context) => default;
|
||||
private readonly IList<ActivityCompletionCallbackEntry> _completionCallbackEntries = new List<ActivityCompletionCallbackEntry>();
|
||||
private IList<ActivityExecutionContext> _activityExecutionContexts;
|
||||
private readonly IHasher _hasher;
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ public static class WorkflowExecutionContextExtensions
|
|||
};
|
||||
workflowExecutionContext.Scheduler.Schedule(workItem);
|
||||
|
||||
// If no resumption point was specified, use "Complete" to prevent the regular "ExecuteAsync" method to be invoked and instead complete the activity.
|
||||
workflowExecutionContext.ExecuteDelegate = bookmark.CallbackMethodName != null ? bookmarkedActivity.GetResumeActivityDelegate(bookmark.CallbackMethodName) : WorkflowExecutionContext.Complete;
|
||||
// If no resumption point was specified, use a "noop" to prevent the regular "ExecuteAsync" method to be invoked and instead complete the activity.
|
||||
workflowExecutionContext.ExecuteDelegate = bookmark.CallbackMethodName != null ? bookmarkedActivity.GetResumeActivityDelegate(bookmark.CallbackMethodName) : WorkflowExecutionContext.Noop;
|
||||
|
||||
// Store the bookmark to resume in the context.
|
||||
workflowExecutionContext.ResumedBookmarkContext = new ResumedBookmarkContext(bookmark);
|
||||
|
|
|
|||
Loading…
Reference in a new issue