Daniel W
Daniel W

Reputation: 31

Cancelling a CronSchedule workflow after allowing it to finish

If I have a workflow with Cronschedule specified with multiple activities, is there a way to cancel/terminate it only after all activities in the workflow have been executed. I also don't want it to have the ContinueAsNew status anymore.

Upvotes: 0

Views: 587

Answers (1)

Long Quanzheng
Long Quanzheng

Reputation: 2401

Best way is to cancel self as the last step in the workflow. You can either use an activity to call the Cadence API:

CancelWorkflow(ctx context.Context, workflowID string, runID string) error

or use RequestCancel feature.

func RequestCancelExternalWorkflow(ctx Context, workflowID, runID string) Future {

It's called external but if you put self workflowID, it should also work.

Upvotes: 1

Related Questions