0

I need to call a external rest service, if it fails on first attempt then I have to call again after 30 minutes. Max 3 time I can call like this. I know spring has RetryTemplate for the retry. But I feel, for my cases its not fit. I have to call like this for more than 1000 records.

Any idea How can I achieve this in Spring.

1 Answers1

0

Use a TaskScheduler.

scheduler.schedule(() -> { ... }, 
    new Date(System.currentTimeMillis() + (30 * 60_000));

Keep track of how many times and if not exhausted, re-schedule.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179