# Cancellation

This sample demonstrates workflow and activity cancellation with cleanup.

The workflow starts a long-running activity that heartbeats, then races it against the workflow's cancellation signal. When the workflow is cancelled, the activity is cancelled and a cleanup activity runs before the workflow completes.

### Running this sample

1. `temporal server start-dev` to start the Temporal server.
2. In another terminal, start the worker:

```bash
  cargo run --features examples --example cancellation-worker
```

3. In another terminal, run the workflow:

```bash
  cargo run --features examples --example cancellation-starter
```

The starter waits 2 seconds, then requests cancellation. The workflow should complete with a message indicating cancellation and cleanup.
