This PR completes the retry policy feature for Java by allowing developers to implement custom retry policies using code. It's intended for use-cases where declarative retry policies aren't flexible enough.
Example syntax
TaskOptions optionsWithRetryHandler = TaskOptions.FromRetryHandler(retryCtx -> {
// Retries MyException or any sub-class of MyException
if (retryCtx.getLastFailure().isCausedBy(MyException.class)) {
return true;
} else {
// For any other exception type, retry up to 4 times
return retryCtx.getLastAttemptNumber() < 5;
}
});
TaskOrchestration = ctx -> {
ctx.callActivity("MyFlakeyActivity1", null, optionsWithRetryHandler).get();
ctx.callActivity("MyFlakeyActivity2", null, optionsWithRetryHandler).get();
};
Code changes:
New public classes to support custom retry logic
Refactored integration tests to share common logic
This PR completes the retry policy feature for Java by allowing developers to implement custom retry policies using code. It's intended for use-cases where declarative retry policies aren't flexible enough.
Example syntax
Code changes:
Resolves https://github.com/microsoft/durabletask-java/issues/18