Is there any way for workflow to get some additional info when it receives cancel request? Also this additional info should be available for all child workflows.
Additional info that should be passed to canceled workflow and its children is only available at the moment of cancellation, so it is not possible to put it in workflow state in advance.
I would be grateful for any hint.
You can use signal to notify a workflow of something and include custom input. You can also signal children with that input. So you can make a “cancel” signal that you can include anything you’d like and can react to that signal in anyway including treating similar to a cancel. Or is there a specific reason it has to be the workflow cancel feature?
I don’t know in advance how many children will be at the moment of cancellation. and also children could have their own children, that’s why I want to use CancelRequest, because it automatically propagate cancel request to all children. And also client has information only about parent workflow and doesn’t know about children. According to the documentation “A Signal must include a destination (Namespace and Workflow Id) and name”.
You can know how many children. Since you start the children you can maintain the collection of child futures to call signal on. Same for your childrens’ children. If you want to propagate custom input down through children on an event, the signal is the best way.