Closed as not planned
Description
I am using Spring-retry-1.3.4, i want to detect the event before the last retry and insert logic. Is there a way? I think I can use RetryListener, but I can't.
TestService.java
@Retryable(
value = {Exception.class},
maxAttempts = 2
)
public void test1() {
}
@Retryable(
value = {Exception.class},
maxAttempts = 3
)
public void test2() {
}
@Retryable(
value = {Exception.class},
maxAttempts = 4
)
public void test3() {
}
MyRetryListener.java
public class MyListener implements RetryListener {
...
public <T, E extends Throwable> void onError(
final RetryContext context,
final RetryCallback<T, E> callback,
final Throwable throwable
) {
if (getMaxAttemps() == context.getRetryCount()) {
logic();
}
}
private int getMaxAttemps() {
???
}
}
Metadata
Metadata
Assignees
Labels
No labels