Interface RecoverableWorkflowExceptionPolicy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Classifies an exception that escaped a workflow body as recoverable or not.
A recoverable exception describes a condition a later run can succeed on: the engine pauses the workflow, keeps the instance non-terminal and re-drives it on the next start of the processing node or claim of its segment. Any other exception is treated as a defect in the body and fails the workflow durably, so the failure is visible and final.
DEFAULT walks the cause chain and treats these as recoverable:
- any
Error, such as anOutOfMemoryErrororStackOverflowError - an
InterruptedExceptionorStepInterruptedException, raised when the engine stops - a
RejectedExecutionException, raised when an executor is shutting down - an
AxonTransientException, the framework's marker for a condition worth retrying - a
TimeoutExceptionorIOException, raised when infrastructure did not answer
WorkflowCustomization.recoverableExceptionPolicy(RecoverableWorkflowExceptionPolicy).
Without either, DEFAULT applies.
Example usage:
configurer.componentRegistry(registry -> registry.registerComponent(
RecoverableWorkflowExceptionPolicy.class,
config -> RecoverableWorkflowExceptionPolicy.DEFAULT.or(e -> e instanceof BackendUnavailableException)
));
- Since:
- 5.4.0
- Author:
- Stefan Dragisic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RecoverableWorkflowExceptionPolicyThe default classification described in the interface documentation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisRecoverable(Throwable failure) Decides whether the given exception, which escaped the workflow body, is recoverable.Combines this policy with another one, treating an exception as recoverable when either policy does.
-
Field Details
-
DEFAULT
The default classification described in the interface documentation.
-
-
Method Details
-
isRecoverable
Decides whether the given exception, which escaped the workflow body, is recoverable.- Parameters:
failure- the exception that escaped the workflow body- Returns:
trueto pause the workflow for a later run,falseto fail it
-
or
Combines this policy with another one, treating an exception as recoverable when either policy does.- Parameters:
other- the policy to combine with- Returns:
- a policy that accepts what this policy or the other policy accepts
-