Package ch.repnik.quartzretry
Class QuartzRetry<P extends Serializable,R>
- java.lang.Object
-
- ch.repnik.quartzretry.QuartzRetry<P,R>
-
- Type Parameters:
P- Type of the payload (e.g. could be a DTO for sending to a remote service)R- Type of the result (e.g. the response type of the remote service)
public abstract class QuartzRetry<P extends Serializable,R> extends Object
Extend this class for adding quartz retry to your application
-
-
Constructor Summary
Constructors Constructor Description QuartzRetry()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidexecute(P payload)Starts the retry attemptvoidexecute(P payload, RetryContext ctx)Starts the retry atttemptprotected abstract RetryTimeout[]getRetryTimeouts()protected abstract voidonError(P payload, Exception e, RetryContext ctx)protected abstract voidonFailure(P payload, Exception e, RetryContext ctx)protected abstract voidonSuccess(P payload, R result, RetryContext ctx)protected abstract Rprocess(P payload, RetryContext ctx)voidsetScheduler(org.quartz.Scheduler scheduler)Sets the current quartz scheduler automatically by injection There should not be a need to call this method manually.
-
-
-
Method Detail
-
process
protected abstract R process(P payload, RetryContext ctx)
-
getRetryTimeouts
protected abstract RetryTimeout[] getRetryTimeouts()
-
onError
protected abstract void onError(P payload, Exception e, RetryContext ctx)
-
onSuccess
protected abstract void onSuccess(P payload, R result, RetryContext ctx)
-
onFailure
protected abstract void onFailure(P payload, Exception e, RetryContext ctx)
-
setScheduler
@Autowired public final void setScheduler(org.quartz.Scheduler scheduler)
Sets the current quartz scheduler automatically by injection There should not be a need to call this method manually.- Parameters:
scheduler- The current quartz scheduler instance
-
execute
public void execute(P payload)
Starts the retry attempt- Parameters:
payload- The payload object to process
-
execute
public void execute(P payload, RetryContext ctx)
Starts the retry atttempt- Parameters:
payload- The payload object to processctx- The current RetryContext
-
-