I am trying to create a service that will be able to execute some task (a method) and retry it that task fails.
For creating timers I am using a timer service with quartz (I am not able to change the timer service).
Timer service has method
this.timerService.createTimerRunRepeatedly(
handledId,
timerId,
optionalDescription,
totalFireCount,
intervalMiliSeconds,
offsetMiliseconds,
optionalCallbackData);
It is also able to register a handler for created timer.
this.timerService.registerHandler(
handlerId,
firedCallback,
expiredCallback);
firedCallback -> (optional) callback that is called each time a timer with this handler fires (final Consumer<T> firedCallback
)
expiredCallback -> (optional) callback that is called after a timer with this handler has fired the last time (final Consumer<T> expiredCallback
)
I have created a new TaskRetryService but I have no idea how can I pass some method to this retryService for it to be executed.