You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the CancellationToken isn't exposed by the RunAsync abstract method. Traditionally, async methods include the token to be passed to subsequent async calls.
While there isn't currently any support for cancellation tokens, there is discussion about introducing them in the future. Since including it as part of the method signature would be a breaking change, it would make sense to introduce it at this time, during the beta period, in preparation for future use. A CancellationToken.None can be passed for the time being.
The run method signatures should look like the following for workflows and activities respectively, with the interfaces also being modified accordingly.
public abstract class Workflow<TInput, TOutput> : IWorkflow
{
public abstract Task<TOutput> RunAsync(WorkflowContext context, TInput input, CancellationToken cancellationToken);
}
public abstract class WorkflowActivity<TInput, TOutput> : IWorkflowActivity
{
public abstract Task<TOutput> RunAsync(WorkflowActivityContext context, TInput input), CancellationToken cancellationToken);
}
The text was updated successfully, but these errors were encountered:
clintsinger
changed the title
[Workflows] Expose CancellationToken as part of the RunAsync
[Workflows] Expose CancellationToken as part of RunAsync
Jan 12, 2024
For the sake of not creating APIs that we hope to implement (the future often plays out differently than how we expect), I would prefer we plan to add cancellation token support as a property of the context object rather than as a parameter in RunAsync. This would be a non-breaking change that we can implement when we're ready to do so.
For that reason, I suggest we make this a P2 for 1.15 with the intent of actually implementing cancellation (at least for workflow activities) rather than hardcoding it to CancellationToken.None.
Describe the feature
Currently the
CancellationToken
isn't exposed by theRunAsync
abstract method. Traditionally, async methods include the token to be passed to subsequentasync
calls.While there isn't currently any support for cancellation tokens, there is discussion about introducing them in the future. Since including it as part of the method signature would be a breaking change, it would make sense to introduce it at this time, during the beta period, in preparation for future use. A
CancellationToken.None
can be passed for the time being.The run method signatures should look like the following for workflows and activities respectively, with the interfaces also being modified accordingly.
The text was updated successfully, but these errors were encountered: