Hi … we have a requirement of retry : retry every 10 sec for the first min. Then retry every 1 min for the first hour, then retry every hour up to 6 hours. ( retionale is that a condition will likely be ready within 1min, but 99% percentile is under 1 hours. The long tail will be upto 6 hours)
I do not think retrypolicy can implement this requirement. It seems the only option is to implement it as a part of workflow logic. Something like this:
class workflowImpl{
public void flow() {
TimeStamp startTime= new Timestamp(System.currentTimeMillis());
bool isReady=checkCondition();
while( !isReady) {
if ( isWithinFirstMin(startTime)) {
thread.sleep(10 sec); //first min retry
}else if (isWithinFirstHour(startTime)) {
thread.sleep (1 min); //first hour retry
}else if (isWithinSixHour(startTime)) {
thread.sleep( 1 hour); // 6 hour retry
}else {
break; // timeout;
}
isReady= checkCondition();
} //end while
if (isReady) {
//continue my flow;
} else {
// timeout flow.
}
}
}
Welcome any suggestion.
Thanks,