1

I'm trying to add retries to my calls using Spring Retry (newest version).

I've added the following annotation:

@Retryable( maxAttemptsExpression = "${retry.app.maxAttempts}",
            backoff = @Backoff(delayExpression = "${retry.app.backOffDelay}",
            multiplierExpression = "${retry.app.multiplier}"))
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface AppRetryable {
}

and applied it to my HTTP client (Feign).

The values for retryable are defined in the following properties:

retry:
  app:
    multiplier: 2
    backOffDelay: 10000
    maxAttempts: 3

The problem is that while it generally works fine (the calls are being retried every 10s for 3 times) the time doesn't grow exponentially.

I've noticed that if replace delayExpression and multiplierExpression with delay and multiplier and add hardcoded values it works fine. What is more is that replacing just delayExpression also works fine.

In other words:

        backoff = @Backoff(delay = 10000,
        multiplier = 2))

works fine.

And this one is fine too:

        backoff = @Backoff(delay = 10000,
        multiplierExpression = "${retry.app.multiplier}"))

But not:

        backoff = @Backoff(delayExpression = "${retry.app.backOffDelay}",
        multiplierExpression = "${retry.app.multiplier}"))

Is there anything I'm doing wrong or there is a bug in the library?

1 Answer 1

2

There is a recent fix for this (not yet released).

https://github.com/spring-projects/spring-retry/issues/397

Sign up to request clarification or add additional context in comments.

1 Comment

Perfect, now I know the problem is not on my side. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.