Is there a way to add customized logic when executing `WorkflowStub.terminate`

When terminating a workflow by using WorkflowStub.terminate method, I want to call the running activities and do some custom shutdown logic, since these activities can’t be brute force closed or just let them finish (letting them finish doesn’t make sense for termination).

Actually, I’m trying to use WorkflowClientInterceptorBase, but it does not work when executing the terminate method(didn’t call interceptor method…)


Terminating, by definition, is a hard stop without giving a chance to perform any cleanup.

Use cancellation instead.

Yes, I saw the definition.

There are a lot of interceptors here and I think I can implement the function by using them. Also, I need to use cancel to cancel my workflow instead of terminate.

Thanks a lot!