Configuring FixedBackOfPolicy (using annotations)

In this post, under Spring Retry I will show with example how to configure FixedBackOfPolicy using annotations. For our example we will use the below service class Service class 1 import java.util.Date; 2 3 import org.springframework.retry.annotation.Backoff; 4 import org.springframework.retry.annotation.Retryable; 5 import org.springframework.stereotype.Service; 6 7 @Service 8 public class Service13 { 9 private int i =…… Continue reading Configuring FixedBackOfPolicy (using annotations)

Configuring maxAttempts for Retry (using annotations)

In this post under Spring Retry, I will explain with example on how to configure maxAttempts for retry operation using annotation. For our example, we will use the below Service class Service Class 1 import org.springframework.retry.annotation.Retryable; 2 import org.springframework.stereotype.Service; 3 4 @Service 5 public class Service12 { 6 private int i = 0; 7 8…… Continue reading Configuring maxAttempts for Retry (using annotations)

Configuring StatisticsListener (using annotations)

In this post under Spring Retry, I will show with example how to configure StatisticsListener using annotations. As explained in previous posts, StatisticsListener class provided by Spring Retry framework collects statistics of a particular retry operations. The statistics information involves1) Abort Count –> How many times the retry was aborted2) Complete Count –> How many…… Continue reading Configuring StatisticsListener (using annotations)

Configuring Recovery Callback (using annotations)

In this post under Spring Retry, I will show with example how to configure a Recovery callback using annotations. Spring Retry retries fail operations for fixed number of times. If the operations fails even after last attempt, we don’t have any other option but to recover from that failure. Spring Retry provides an annotation that…… Continue reading Configuring Recovery Callback (using annotations)

Configuring exceptions to exclude from retry (using annotations)

In the previous post under Spring Retry, I showed with example how to specify the exceptions through annotation, for which a annotated operation has to be retried. In this post, I will show with example how to mention the exceptions through annotation, that when thrown by a annotated operation, Spring retry shouldn’t retry that operation.…… Continue reading Configuring exceptions to exclude from retry (using annotations)

Configuring Exceptions to include for retry (using annotations)

In this post under Spring Retry, I will show with example how to configure the exceptions for which retry has to happen. For the example I will use the below service class. Service8 1 import org.springframework.retry.annotation.Retryable; 2 import org.springframework.stereotype.Service; 3 4 @Service 5 public class Service8 { 6 private int i = 0; 7 8…… Continue reading Configuring Exceptions to include for retry (using annotations)

Configuring RetryListener (using annotations)

In this post under Spring Retry, I will show with example how to configure RetryListener using annotations. For our example we will need the below “CustomRetryListener2” class CustomRetryListener2 import org.springframework.retry.RetryCallback; import org.springframework.retry.RetryContext; import org.springframework.retry.RetryListener; import org.springframework.stereotype.Component; @Component public class CustomRetryListener2 implements RetryListener { @Override public <T, E extends Throwable> void close(RetryContext arg0, RetryCallback<T, E> arg1,…… Continue reading Configuring RetryListener (using annotations)

Spring Retry simple example (using annotation)

In this post under Spring Retry, I will explain how to configure Spring Retry framework into your application using annotation with simple example At minimum, you need the below jars in your classpath1) spring-retry-1.3.1.jar2) commons-logging-1.2.jar3) spring-core-4.3.22.RELEASE.jar4) spring-aop-4.3.22.REELEASE.jar5) spring-beans-4.3.22.RELEASE.jar6) spring-context-4.3.22.RELEASE.jar7) spring-expression-4.3.22.RELEASE.jar8) aspectjweaver-1.8.9.jar For the example I will use the below service class Service6 1 import org.springframework.retry.annotation.Retryable;…… Continue reading Spring Retry simple example (using annotation)