spring-retry icon indicating copy to clipboard operation
spring-retry copied to clipboard

@Retryable for Reactive Streams

Open alexsderkach opened this issue 7 years ago • 10 comments

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.

alexsderkach avatar Oct 31 '17 21:10 alexsderkach

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 avatar Nov 04 '17 14:11 dsyer

@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

alexsderkach avatar Nov 30 '17 20:11 alexsderkach

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 avatar Dec 01 '17 10:12 dsyer

@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.

alexsderkach avatar Dec 01 '17 10:12 alexsderkach

Sounds good.

dsyer avatar Dec 01 '17 11:12 dsyer

@dsyer So, Could spring-reply have supported the reactive streams? I have the same scenario.

baotoushashou avatar May 17 '20 09:05 baotoushashou

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 avatar May 18 '20 10:05 dsyer

@dsyer Ok. Thanks. I have used the retry of reactor. I seems everything is ok.

baotoushashou avatar May 19 '20 03:05 baotoushashou

Any update? Reactor built in retry framework is a bit hard to use, you can reference Resilience4j implementation

CoderYellow avatar Apr 09 '23 10:04 CoderYellow

您好,我已经收到您的邮件,将尽快给您回复。

gaofengIt avatar Apr 09 '23 10:04 gaofengIt