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)
Tag: RetryListener
Configuring RetryListener for RetryTemplate (using RetryTemplateBuilder)
In this post under Spring Retry, I will show with example how to configure RetryListener using RetryTemplateBuilder class. First we will create a custom listener class which implements RetryListener interface as shown below CustomRetryListener1 import org.springframework.retry.RetryCallback; import org.springframework.retry.RetryContext; import org.springframework.retry.RetryListener; public class CustomRetryListener1 implements RetryListener { @Override public <T, E extends Throwable> void close(RetryContext arg0,…… Continue reading Configuring RetryListener for RetryTemplate (using RetryTemplateBuilder)
RetryListener Example
In my previous post, I explained how to configure job retry if job fails in first attempt. In this post under Spring Batch, I will explain with example how to configure RetryListener. With the help of RetryListener you can listen to error events and respond appropriately. To create an exception that will force the job…… Continue reading RetryListener Example