Hey guys, is there any alternative to Spring-retry...
# spring
l
Hey guys, is there any alternative to Spring-retry? It doesn't seem to be maintained anymore, and some of the things I need aren't possible to do with it (example a bean with the default retrytemplate)
n
seems quite okay to me https://github.com/spring-projects/spring-retry/commits/master besides, if it’s considered feature-complete why should there be any update?
besides, it’s not kotlin-related
l
For some reason I thought the last commit was February 2019. My bad
o
https://github.com/spring-projects/spring-retry/issues/99 I don’t recommend it if you plan to use the circuit breaker part because of the linked issue
I can confirm that the issue is still present, with constant traffic open circuits are not closed properly, so after the circuit is opened you may stick to your fallback forever
r
Copy code
suspend fun ClientResponse.asResponse(): ServerResponse =
    status(statusCode())
        .headers { headerConsumer -> headerConsumer.addAll(headers().asHttpHeaders()) }
        .body(bodyToMono(DataBuffer::class.java), DataBuffer::class.java)
        .retryWhen { 
            Retry.onlyIf { ctx: RetryContext<Throwable> -> (ctx.exception() as? WebClientResponseException)?.statusCode in retryableErrorCodes }
                .exponentialBackoff(ofSeconds(1), ofSeconds(5))
                .retryMax(3)
                .doOnRetry { log.error("Retry for {}", it.exception()) }
        )
        .awaitSingle()
207 Views