Add Nexus cancellation sample#718
Conversation
| @Override | ||
| public NexusService.HelloOutput hello(NexusService.HelloInput input) { | ||
| // Sleep for a random duration to simulate some work | ||
| Workflow.sleep(Duration.ofSeconds(Workflow.newRandom().nextInt(5))); |
There was a problem hiding this comment.
Would encourage something a bit more deterministic here so that the same amount of cancellations happen every sample run (e.g. maybe pretend that EN is always slower or something)
There was a problem hiding this comment.
Sure, can do that
There was a problem hiding this comment.
Let me know what you end up with and I'll update the Go sample. I kinda like that this isn't deterministic and you may get surprising results.
| // If the operation was cancelled, we can ignore the failure | ||
| if (e.getCause() instanceof CanceledFailure) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Wonder if we should log or otherwise make clear to a user that the cancel occurred. User may not need it in their workflow, but for the sample, it's hard to know that anything even got canceled without going to the UI
There was a problem hiding this comment.
Good point
Add Nexus cancellation sample