0

We have situation and architecture looks like below.

RabbitMQQueue -> Spring Boot RabbitMQ Listener -> Service Layer -> (Network call).

In above network call depends on the URL sent in each message from the queue.

Now many times this network calls fails as its external servers with 429 error code.

Remember above are so many different URLS and its comming from a single Queue.

We implemented the retry using spring retry and we have seen improvements but as the scale and the number of requests are too high

We need to do some improvement in the retry

Currently retry is implemented with fixed back off and max attempts as 3

I am thinking of using the retry-after which means in each retry to network call I need to have the different backoffpolicy

Is this viable and correct approach or is there any improvement can be done at any level?

Can we have separate backoffpolicy for each retry which will be performed

Please suggest if this can be achieved by spring retry

Viral Kondhia
  • 51
  • 1
  • 10

1 Answers1

0

You could write a custom BackOffPolicy that delegates to different backoff policies, depending on information in the BackOffContext.

The backoff context in the RetryContext under key backOffContext.

See the javadocs for BackOffPolicy.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179