Temporal Workflow steps on workflow failure

New user here.

I have a workflow defined with steps A, B, and C.
Is it possible to catch and execute step D if the workflow fails, including retries?

Working in Java.
Any help is appreciated!

Don’t fail the workflow. Handle error without failing it:

try {
} catch (... ) {

Thanks, Maxim!
Sorry, new to temporal over here.

Would “A” be tried multiple times if inside a try catch block? I don’t want to strip temporal of it’s ability to retry the steps A, B, and C.

Also, been looking through temporal FAQ and I feel honored you are replying! You are on so many questions I’ve been reading about. Thanks for supporting the community!

I assume that A, B, C, D are activities. Activities are retried by default (can be disabled by setting RetryOptions.MaxAttempts to 1). So if any of them fails it will be retried. You can specify which exceptions are not retried if you want to fail an activity and execute D as compensation.

Thanks for supporting the community!

You are welcome! Without the community the project and the company wouldn’t get anywhere.

Got it working! Thanks so much and Happy Friday! Extremely appreciate the quick and clear response!

1 Like