Questions tagged [spring-retry]

Spring Retry provides an abstraction around retrying failed operations, with an emphasis on declarative control of the process and policy-based behaviour that is easy to extend and customize.

The Spring Retry project is refactored from Spring Batch's support for retrying operations as of Spring Batch 2.2.0. It is used in several Spring projects.

See also

469 questions
0
votes
0 answers

How to retry 5 times with intervals of 1, 5, 10, 30, 60 seconds using Spring Retry in Java

For example, the method was called at 12:00:00 but failed. I like it to retry at 12:00:01, 12:00:06, 12:00:16, 12:00:46, 12:01:46 How could I make it happen using Spring Retry in Java I tried the following Custom BackOff Policy but it shows error: …
Pip
  • 19
  • 3
0
votes
0 answers

@Retryable not affecting JUnit5 test

I have an simple class to test @Retryable annotation: @Component public class SimpleRetryComponent { private final AtomicLong counter = new AtomicLong(0L); @Retryable(maxAttempts = 3, backoff = @Backoff(delay = 100, multiplier = 2,maxDelay =…
PolGraphic
  • 3,233
  • 11
  • 51
  • 108
0
votes
1 answer

How to edit message data before sending to DLT in Spring-Kafka

I read a lot of documentation and a lot of issues on github of spring-kafka and still didn't get how to make spring DeadLetterRecovererFactory use my custom DeadLetterRecoverer. Long story short - I want to modify the record before sending it do…
0
votes
0 answers

Spring-retry UniformrandomBackOff vs ExponentialRandomBackoff

Spring retry provides a UnifromRandomBackOff. Is there any study on how it performs in practice compared to well-known ExponentialRandomBackoff? Is there any guideline on which to be preferred?
tuk
  • 5,941
  • 14
  • 79
  • 162
0
votes
0 answers

What is an elegant way to retry a method for specific HTTP code

Hi an a method annotated with @Retryable annotation @Override @Retryable( value = FeignException.class, maxAttempts = 2, backoff = @Backoff(delay = 100)) public Map fetchMediaResponseFromMediaIds(Set mediaIds) { …
Aman Kumar Sinha
  • 407
  • 6
  • 17
0
votes
1 answer

Update spring boot retry maxAttempts at runtime

I need to use spring boot retry logic in my code. My retry method is getting call from multiple method, so I want to run retry logic for all caller method but retry logic is running only for first caller method and for later caller method, it is…
0
votes
1 answer

JUnit testing for Spring @Retryable maxAttempts not working

I have used Spring's retry in my project to achieve retry functionality for specific exceptions. SomeService.java @Service @Slf4j public class SomeService implements AuthenticationService { private static final String LOGIN_END_POINT =…
0
votes
1 answer

How to retry rest-endpoint with spring-retry based on response object rather than the status code?

In the spring-boot application, I am calling a rest endpoint which results in 200 success status code and the response object is something like this: { "id" : "some-uuid", "status" : "success" } Possbile values for the status object are…
Pranaya Behera
  • 545
  • 1
  • 9
  • 24
0
votes
1 answer

Multiple Retries Happening in Kafka

I have used RetryTemplate along with DeadLetterPublishingRecoverer and SeekToCurrentErrorHandler in my Kafka Consumer config but the retries are not stopping and exceeding the limit. public class KafkaConsumerConfig { …
0
votes
0 answers

How to get the retried user information of a spring batch job?

I have username sent as a job parameter to a batch job. When the job fails, there is a retry option provided. This can be retried by the same user or a different user. I know that the same job instance is retried and the job parameters cannot be…
SJB
  • 17
  • 1
  • 9
0
votes
1 answer

send kafka retryable message to one topic via spring retry

I use spring retry to implement a retry system for kafka consumer. My consumer code is package com.kafka.errorhandling.demo.listener; import org.apache.kafka.common.errors.SerializationException; import…
0
votes
0 answers

How to call @Recover method from Junit Testcase

@Retryable(value = {UnknownHostException.class, ResourceAccessException.class, HttpClientErrorException.class}, maxAttemptsExpression = "#{${labelling.service.retry.maxAttempts}}", backoff = @Backoff(delayExpression =…
0
votes
0 answers

notRetryOn method works as not expected

Warn: touching this method drops default retryOn(Exception.class) and you should configure whole classifier from scratch. public RetryTemplateBuilder notRetryOn(Class throwable) { …
0
votes
1 answer

Spring logs a warning with vanilla @SpringBootApplication and @EnableRetry

With a minimal Spring Boot Application at version 3.0.4 (current stable version) using spring-retry with @EnableRetry, I see the following warning: 2023-03-06T17:23:58.313-05:00 WARN 97421 --- [ main]…
Chad Showalter
  • 211
  • 1
  • 12
0
votes
1 answer

How to exclude specific exceptions from Spring AMQP retry policy with SimpleRetryPolicy?

I have a RabbitListener in my Spring AMQP application and I'm using a custom RabbitListenerFactory with a SimpleRetryPolicy configured for message retries. However, I want to exclude certain exceptions from being retried. Currently, my configuration…