How to add Resiliency to any APIs
Resiliency Handler Resiliency Handler This simple generic class helps to add resiliency to any APIs with follow delay strategies Exponential backoff and jitter strategy. Fixed delay strategy. ResiliencyHandler.java package circuitbreaker; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; /** * Generic ResiliencyHandler to simplify retry operations with fixed/exponential * backoff delay strategies * * <pre> * Student student = * ResiliencyHandler.buildFor(Student.class) * .usingJitterStrategy(3, 10L * 1000L) * .tryWithResiliency(() -> studentService.getStudent()) * .fallbackOnFail(() -> studentService.getDefaultStudent()) * .getResult();// return result * * </pre> * * @param <R> ResultType * * @author ThirupathiReddy Vajjala */ @Slf4j public class R