cancel from Context API
Expose the ability to do a one way call from the Context, then cancel/kill it from context too.
Temporary workaround: if a workflows' own invocationId is exposed in the context (its already in ContextImpl, just needs to be made public) then workflows can expose a cancel handler which cancels itself using their invocationId and #412. External services can cancel it using the handler (ctx.workflowSendClient(Foo, key).cancel()).
I'm doing this for now by bypassing typescript's fake private fields and just grabbing ctx.stateMachine.invocation.debugId
With a bit of work you can make this work for services too, by making service calls self-register in some virtual object. Wouldn't recommend it.
Train of PRs:
- https://github.com/restatedev/service-protocol/pull/96
- https://github.com/restatedev/restate/pull/1967
- https://github.com/restatedev/sdk-shared-core/pull/10
- https://github.com/restatedev/sdk-rust/pull/27
- https://github.com/restatedev/sdk-test-suite/pull/11
Done in Protocol V4
Is there now a way to do this from the SDK? I can't find it in the Rust SDK, at the very least.
This is not available in any SDK yet, this was the server part of the feature. In Rust SDK there is an open PR https://github.com/restatedev/sdk-rust/pull/27 but I need to finish this one yet.