A kit of unrelated tools for Java developers
Simple and lightweight retry library for Java, it helps you transparently retry failed operations.
import static io.github.pepperkit.retry.Retry.retry;
retry(3)
.backoff(new BackoffFunction.Exponential())
.delay(Duration.ofMillis(500))
.maxDelay(Duration.ofSeconds(3))
.handle(HttpServiceUnavailable.class)
.run(()->{
webClient.get("https://some.example.com/v1/resource");
// webClient.get() throws HttpServiceUnavailable exception
// e.g. try to get this resource 3 times when the HttpServiceUnavailable exception has occurred
// we have some assumption, this service can be available later...
});
retry:1.0.0 has been released and available
<dependency>
<groupId>io.github.pepperkit</groupId>
<artifactId>retry</artifactId>
<version>1.0.0</version>
</dependency>
implementation 'io.github.pepperkit:retry:1.0.0'