Menu

resilience4cata 1.0.0: resilience annotations for Java, generated at compile time
📰

resilience4cata 1.0.0: resilience annotations for Java, generated at compile time

DEV Community: java·Fabián Guamán Flores·13 days ago
#6sfknuWf
#devtojava#devto#dev#resilience4cata#release
Long article (802 words) — no AI summary yet.
Reading 0:00
15s threshold

resilience4cata 1.0.0 is on Maven Central. After four release candidates, it is the first stable release, and from now on compatibility is a written promise for the whole 1.x line.

What it is

resilience4cata is a resilience library for Java 21+:

retry, circuit breaker, rate limiter, timeout, bulkhead and fallback;

plus hedging and an adaptive concurrency limit.

You annotate an interface or a class:

public interface PriceClient {

@Retry ( maxAttempts = 3 , delay = "100ms" ) @CircuitBreaker ( name = "prices" ) @Timeout ( "2s" ) @Fallback ( method = "unknownPrice" ) BigDecimal price ( String sku ) throws IOException ;

default BigDecimal unknownPrice ( String sku , Exception failure ) { return BigDecimal . ZERO ; } }

Enter fullscreen mode

Exit fullscreen mode

At compile time, an annotation processor writes a plain Java class next to it, PriceClient$Resilient , that calls each policy directly. It needs no proxy, aspect or agent.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.