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
7
votes
3 answers

spring retry setRetryableExceptions, setFatalExceptions not available

According to the spring batch/retry documentation (http://docs.spring.io/spring-batch/reference/html/retry.html) in section 9.2 one can specify which exceptions you would like to retry or not retry on via setRetryableExceptions or setFatalExceptions…
user3537621
  • 151
  • 2
  • 4
6
votes
1 answer

Change parameter values on each Spring Retry attempt

I have following method which is @Retryable: @Retryable(value = HttpClientErrorException.class) public Integer callToExternalService(DateTime start, DateTime end) throws MyException My question is if I can modify input parameters each time…
Clawdidr
  • 577
  • 1
  • 8
  • 25
6
votes
2 answers

Spring Retry Framework with Annotation not Working

I tried spring retry framework with Simple java classes using SimpleRetryPolicy/RetryTemplate. It worked fine. So I thought of doing the same with Annotations. Annotations never worked for me. Didn't find much help online as well. The following code…
karthik
  • 773
  • 2
  • 11
  • 19
6
votes
2 answers

Spring annotation @Retryable - how to set an interceptor

I am using a @Retryable annotation on a method in a @Serviceclass @Service @EnableRetry public class PushService { @Retryable(maxAttempts=5) public Result pushIt(myMessage messageIn) { ... } } and it works like a charme: I am…
Ing. Luca Stucchi
  • 3,070
  • 6
  • 36
  • 58
5
votes
1 answer

How to mock Spring's @Retryable attributes such as maxAttemps and delay in SpringBootTest

I have a method which I'm trying to test @Retryable(value = {SocketTimeoutException.class}, backoff = @Backoff(delay = 10000), maxAttempts = 4) public String getNewString(String oldString) throws IOException{ ... } I…
Paras Thakur
  • 119
  • 1
  • 9
5
votes
2 answers

How to retry a PostgreSQL serializable transaction with Spring?

I am developing against a PostgreSQL v12 database. I am using SERIALIZABLE transactions. The general idea is that when PostgreSQL detects a serialization anomaly, one should retry the complete transaction. I am using Spring's…
user8870331
5
votes
1 answer

Spring batch: Retry job if does not complete in particular time

I am working on a Spring batch application where I have used RetryTemplate with SimpleRetryPolicy. In this application, ItemProcessor usually takes 30-35 mins to complete a particular task. But sometimes, it takes from than 2hrs to complete that…
5
votes
1 answer

Call @Retryable method in a method that is annotated with @Async not working

The below @Retryable code works where there is a direct call to method, but retryable method call through @Async annotated method then throws an exception. Any suggestions ? Here is my Service Class @Service public class RetryAndRecoverService { …
5
votes
1 answer

How to combine Retryable and CircuitBreaker together in Spring?

Spring's @Retryable annotation will retry three times (default) and fallback to the @Recovery method. @CircuitBreaker however, will retry once and fall back when the state is closed. I want to combine these two: when the circuit breaker state is…
Zebing Lin
  • 371
  • 4
  • 6
5
votes
2 answers

@Recover methods are not triggered with @Retryable

I followed this question after getting ExhaustedRetryException on @Retryable function. The @Retryable function is retrying. Here's the Delegate with the @Retryable function: @Component public class OrderRequestDelegate { private static final…
Joe Essey
  • 3,457
  • 8
  • 40
  • 69
5
votes
2 answers
5
votes
1 answer

How to integrate Spring Retry with AsyncRestTemplate

How can you integrate Spring Retry with external calls with AsyncRestTemplate? If it's not possible, is there another framework that supports it? My use case: public void doSomething() throws ExecutionException, InterruptedException { …
Glide
  • 20,235
  • 26
  • 86
  • 135
5
votes
0 answers

Spring Batch: Retry chunk in smaller chunks vs single item processing

I have an application that uses Spring Batch 3.0.6. The Spring Batch job uses chunk processing. The commit interval is set to 100 and the retry limit is set to 5. The writer writes a data chunk (of 100 records) to another application (via TCP)…
5
votes
2 answers

@Retryable not making retries when triggered by Integration tests In A Spring Boot Application

I have a simple method in a Service in a SpringBoot Application. I have the retry mechanism setup for that method using @Retryable. I am trying integration tests for the method in the service and the retries are not happening when the method throws…
user3451476
  • 297
  • 1
  • 4
  • 17
4
votes
1 answer

What is the interaction between the @Transactional and @Retryable annotations in spring?

According to Does annotations order matter? the order shouldn't matter, however for these two it seems that the order does matter. If the transaction occurs within the retry, then the transaction could roll back, throw an exception, then spring will…
Bryan Tan
  • 221
  • 1
  • 11
1 2
3
31 32