Hi,
We have our setup like this: we have a non temporal service which calls a temporal service to initiate a temporal workflow. I want to set timeout for a temporal workflow as 30 days.
We are achieving that with:
But along with that in case wf times out I want to get callback to non temporal service to mark in some other database that the workflow is timedout in order to retry those wofkflows after some time.
Workflow timeout terminates workflow without giving it any chance to perform any cleanup. That’s why we don’t recommend using it for business-level timeouts. The solution is to implement this logic as part of the workflow code. Depending on your use case it can be done in different ways. For example if your workflow has to wait for some external signal up to 30 days you can use await:
boolean timedOut = Workflow.await(Duration.ofDays(30), ()->signalReceived);
if (timedOut) {
// send notification to external service
}