Skip to main content

Cancellation - .NET SDK feature guide

This pages shows the following:

  • How to handle a Cancellation request within a Workflow.
  • How to set an Activity Heartbeat Timeout.
  • How to listen for and handle a Cancellation request within an Activity.
  • How to send a Cancellation request from a Temporal Client.

Handle Cancellation in Workflow

How to handle a Cancellation in a Workflow in Go.

Handle Cancellation in an Activity

How to handle a Cancellation in an Activity in Go.

Request Cancellation

How to request Cancellation of a Workflow and Activities in Go.

How to interrupt a Workflow Execution

You can interrupt a Workflow Execution in one of the following ways:

The following are the main differences between canceling and terminating a Workflow in Temporal:

Cancel

Canceling a Workflow provides a graceful way to stop Workflow Execution.

Terminate

How to terminate a Workflow Execution in .NET

Summary

In summary:

  • Canceling provides a graceful way to stop the Workflow and allows it to handle cancelation logic.
  • Termination forcefully stops the Workflow and prevents any further events.

In most cases, canceling is preferable because it allows the Workflow to finish gracefully. Terminate only if the Workflow is stuck and cannot be canceled normally.