spring-retry
spring-retry copied to clipboard
@Retryable for Reactive Streams
I want @Retryable to work, out of the box, with Reactor & RxJava types. Right now I am using custom annotation & aspect to achieve this. It would be nice to have this in Spring.
Reactor has its own retry framework, and we don’t know yet if it can be adapted to the declarative model in spring-retry. It’s far from obvious how it would work (to me anyway). If you have some code you can share that will be great.
@dsyer The idea is to determine return type of method and if it is reactive, apply native retry operators to method invocation.
Here's brief code of idea: https://github.com/alexsderkach/spring-retry/commit/b3ed65dfd4c679e57f3459c339365c0294a139b2#diff-3bfaa81683b86ac2ed9fa843029363b6R362
That's a start. I see that you changed the contract of BackoffPolicy
(and then it looks like you didn't use the value it generated in the non-reactive case?). We probably need to refactor it so that reactor is optional.
@dsyer We could achieve the same by adding additional classes, which will work when reactor is on classpath, without change of existing contracts.
If you approve this idea, I could implement this approach.
Sounds good.
@dsyer So, Could spring-reply have supported the reactive streams? I have the same scenario.
Again, Reactor has its own retry mechanism. You should use it.
If we implement something here it is likely to be along the lines outlined in #176 (there's a branch in my fork with some working code).
See also #25, #154.
@dsyer Ok. Thanks. I have used the retry of reactor. I seems everything is ok.
Any update? Reactor built in retry framework is a bit hard to use, you can reference Resilience4j implementation
您好,我已经收到您的邮件,将尽快给您回复。