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
Create a `Client` instance then then call `CancelWorkflow` to cancel a workflow. When a workflow is canceled, it's workflow context is canceled. Any subsequent calls to schedule activities or sub-workflows will immediately return an error, skipping their execution. Any activities already running when a workflow is canceled will still run to completion and their result will be available.
243
+
244
+
Sub-workflows will be canceled if their parent workflow is canceled.
return errors.Wrap(err, "could not get ActivitySkip result")
282
+
}
283
+
284
+
return"some result", nil
285
+
}
286
+
```
287
+
240
288
### Running activities
241
289
242
-
From a workflow, call `workflow.ExecuteActivity` to execute an activity. The call returns a `Future` you can await to get the result or any error it might return.
290
+
From a workflow, call `workflow.ExecuteActivity` to execute an activity. The call returns a `Future[T]` you can await to get the result or any error it might return.
Canceling activities is not supported at this time.
304
+
253
305
### Timers
254
306
255
307
You can schedule timers to fire at any point in the future by calling `workflow.ScheduleTimer`. It returns a `Future` you can await to wait for the timer to fire.
return"", errors.Wrap(err, "could not get activity result")
303
357
}
304
358
305
-
log.Println("A1 result:", r1)
306
-
359
+
logger.Debug("A1 result:", "r1", r1)
307
360
return r1, nil
308
361
}
309
362
```
310
363
311
-
### Canceling workflows
364
+
#### Canceling sub-workflows
312
365
313
-
Create a `Client` instance then then call `CancelWorkflow` to cancel a workflow. When a workflow is canceled, it's workflow context is canceled. Any subsequent calls to schedule activities or sub-workflows will immediately return an error, skipping their execution. Activities or sub-workflows already running when a workflow is canceled will still run to completion and their result will be available.
366
+
Similar to timer cancellation, you can pass a cancelable context to `CreateSubWorkflowInstance` and cancel the sub-workflow that way. Reacting to the cancellation is the same as canceling a workflow via the `Client`. See [Canceling workflows](#canceling-workflows) for more details.
314
367
315
-
Sub-workflows will be canceled if their parent workflow is canceled.
0 commit comments