What’s the difference between a terminating a workflow or cancelling it? When should either be done?
1 Like
Another question I have is how does cancelling work? If I signal to the workflow to cancel, does it finish executing some activity or workflow task, or does it immediately cancel and end?
Cancelling gives a chance for your code (both Workflows and Activities) to react to being cancelled. They can even ignore the cancellation request (by catching and not rethrowing CancelledFailure
).
More info:
Another question I have is how does cancelling work?
An error gets thrown from places the Workflow and Activity is blocked that are cancellation-aware. You can use isCancellation(err)
to check: Temporal TypeScript SDK developer's guide | Temporal Documentation
3 Likes