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
4
votes
0 answers

SQL Server returned an incomplete response. The connection has been closed.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException:

We are in the process of moving to Azure SQL Server from Oracle DB for our Spring Batch application that runs for few hours with 50 Threads. Below is my JDBC Configuration MSSQL_DRIVERCLASSNAME:…
One Developer
  • 99
  • 5
  • 43
  • 103
4
votes
4 answers

Spring bootstrap + retry + actuator refresh fails the attempt

Here is the Spring repo that was used as a reference (same happened to my project): https://github.com/spring-guides/gs-centralized-configuration.git If I add these dependencies to complete/configuration-client module implementation…
4
votes
1 answer

Spring Retry vs Hystrix

What's the difference between @CircuitBreaker from spring-retry and @HystrixCommand from spring-cloud-starter-netflix-hystrix? They both seem to implement the circuit breaker pattern. And the offical Spring guide is using @HystrixCommand:…
George
  • 2,820
  • 4
  • 29
  • 56
4
votes
1 answer

Spring Retry - Exception problem and retries

How can we catch two different exceptions (ex. from .lang and .io packages) in the same block of @Retryable method. One, we return an IOException and the other we retry the method. @Retryable(value = {Exception.calss } ,maxAttempts = 3, backoff =…
Med
  • 45
  • 1
  • 8
4
votes
2 answers

Write Junit test case for Spring Retry max atttemps

I would like to write a junit test case for spring retry, i tried like the below, but the junit is not working as expected. I am calling MaxAttemptRetryService.retry method, if it fails, it has to try for max 3 times. Here, Dao is calling a rest…
user2000189
  • 479
  • 4
  • 6
  • 22
4
votes
1 answer

StreamRetryTemplate for Spring Cloud Streams not retrying in integration tests

We are utilizing Spring Cloud Streams that listen to a Kafka topic and call a rest service. We also implement a custom StreamRetryTemplate to specify what kind of errors we deem recoverable and which we do not. I cannot get consistent results…
4
votes
2 answers

Spring-Retry cannot locate recovery method when implement an interface

I found a problem when doing spring-retry with spring boot. When a class implements an interface, it cannot enter the @recover method after exceeding the maximum number of retries. But when I inject a normal class, I can enter this method.Your…
Aezio
  • 203
  • 5
  • 18
4
votes
1 answer

How to configure RetryTemplate only for Http status code 500?

I'm using spring-retry (with java 8 lambda) to retry the failed REST calls. I want to retry only for those call which returned 500 error. But I'm not able to configure retrytemplate bean for that. Currently the bean is simple as…
VaibS
  • 1,627
  • 1
  • 15
  • 21
4
votes
2 answers

Different retry attempts for different exceptions in Spring @Retryable

In my SpringBoot app I have a Client, which can send a POST request. And during POST it can have several exceptions. I want to have a retry logic in case of 2 different exceptions. But in a way that the max-retry-attempts should take effect for each…
victorio
  • 6,224
  • 24
  • 77
  • 113
4
votes
1 answer

Spring new transaction combined with Retryable

If I have a method that has a Spring retryable for a certain exception, and also has a Transactional(Requires_new), every time the retry is done, will it create a new transaction or use the existing one? ie @Retryable(maxAttempts = 5, backoff =…
Crackers91
  • 149
  • 3
  • 16
4
votes
1 answer

Using @Retryable in methods define in spring bean's base class are not retried

I have a spring managed bean of type B. I have @EnableREtry in a @Configuration class. When I use @Retryable on doStuff(), the method gets retried on failure as expected. But, the method I really want to retry is a method defined in the base class,…
Stealth Rabbi
  • 10,156
  • 22
  • 100
  • 176
4
votes
1 answer

Stop Spring Cloud Stream @StreamListener from listening when target system is down

I have an application that gets messages from Kafka and calls a target system to update a legacy Oracle DB. I want to enable a scenario where if the target system is down, to leave the messages on Kafka bus and not process them for a given period of…
4
votes
1 answer

Spring AMQP StatefulRetryOperationsInterceptor not used

I am trying configure spring amqp to only retry a message a defined amount of times. Currently a message that fails e.g. because of a DataIntegrityViolationException is redelivered indefinitely. According to the documentation here I came up with…
Mathias Dpunkt
  • 11,594
  • 4
  • 45
  • 70
4
votes
1 answer

BackOffPolicy and SimpleRetryPolicy not in effect when injected into RetryTemplate

I am using Spring AMQP to send messages and be able to perform retries on a "custom" Exception. Lets say I have a Receiver which throws a custom exception "EventException" and for that, I want there to be a n number of retries (in our example 5).…
Ali Moghadam
  • 1,270
  • 8
  • 17
4
votes
2 answers

spring integration kafka error handling

We started using spring-integration-kafka in a project, but couldn't find any documentation on suggested approach for error handling on the consumer side. Ideally we'd want a back-off retry policy without blocking threads, so, it seems stateless…
heyu
  • 185
  • 1
  • 13