Reputation: 17
For example, the method was called at 12:00:00 but failed.
I like it to retry at 12:00:01, 12:00:06, 12:00:16, 12:00:46, 12:01:46
How could I make it happen using Spring Retry in Java
I tried the following Custom BackOff Policy but it shows error:
@Autowired
private BackOffPolicy customBackOffPolicy;
@Retryable(value = Exception.class, maxAttempts = 6, backoff = @Backoff(customBackOffPolicy))
public ResponseResult<List<String>> get() {
System.out.println("start: " + LocalTime.now());
ArrayList<String> list = new ArrayList<>(List.of("A", "B", "C"));
System.out.println("done");
return ResponseResult.success(list);
}
Upvotes: 0
Views: 589