We are trying to add some custom business logic that we want to run at the start of a workflow and end of a workflow. And we want to run this logic on server side.
We are using a grpc-proxy server to intercept the requests between temporal frontend and temporal client.
For instance when a workflow is triggered we see that a
StartWorkflowExecutionRequest is received.
Similarly are there specific requests that are triggered when a workflow completes? And equivalently for activities?
This will depend if your client waits for execution result or not. StartWorkflowExecution unblocks when the execution has been created and persisted on the server.
If client waits for result after execution is started, client would make GetWorkflowExecutionHistory request (long-poll) to frontend service and tell service to wait until a closing event is reached for the execution before responding.
If client does not wait there is nothing service “sends back”, there is no push from service to all clients that might be waiting for this execution to complete.
Wondering why you want to do this on server side? Probably much easier to do via workflow interceptors.
Could you elaborate a bit on workflow interceptors or do you have an existing resource link?
We are doing it on server side to ensure temporal clients do not get to bypass this at will or due to a miss.