I am using exponential retry in Kafka consumer. And it is working as expected but I need to add some more configuration to it. Suppose after the maximum retry attempt, the request is still not successful then I need to retry it for a fixed time thereafter.
Suppose the multiplier is 2 and the maximum retry attempt is 4 with an initial retry interval 1sec
Then retry sequence will be
1sec, 2 sec, 4 sec, 8 sec.
After the fourth attempt, I need retry to occur at a fixed interval (say after each 10sec) until the request is successful.
Is there any way I can achieve this?
Assuming you are using the ExponentialBackOffPolicy
in the RetryTemplate
, you can set its maxInterval
property.
If you are using a SeekToCurrentErrorHandler
with an ExponentialBackOff
instead (which is preferred with modern versions of spring-kafka - to avoid a rebalance), it, too, has a maxInterval
property.