Issue with retry an mutiple chained Unis #1435
-
I am currently having an issue I am not able to solve when using retry with multiple chained unis. I have something like this
I want to retry only uni 3 when it fails, but I want it to actually rerun the supplier since some data the supplier is using may have changed and needs to be rebuilt before going outside. When trying uni1.chain(uni2::get).chain(uni3::get).onFailure().call(onfailure::get).onFailure().retry().until(predicate); it does partially work, but the whole chain is retried, which I am unsure why in a way since the onfailure is after a single uni, after the other emitted OK. So this does not work. Then I tried something more like this; uni1.chain(uni2::get)
.chain(
()->uni3.get().onFailure().call(onfailure::get).onFailure().retry().until(predicate)
); using this way the supplier is called once but never on failure. The idea was to have uni3 as a supplier but be called before appending the onFailure. I would like to know how can I retry a single step in a chained pipeline, while recalling the supplier/or method/ so I can do the http call with the updated data. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
@jponge sorry for the ping, any ideas here how the retry could use the supplier? Only idea I have is quite cumbersome which would be to have the cancellation in a AtomicReference, and cancel in the failure then resubscribe, if that can even work. |
Beta Was this translation helpful? Give feedback.
-
I forgot to follow up on this. Ultimately the solution was quite easy, once you know about it. Ultimately a uni, can already be a sort of supplier by using either So in the end I could have, re-subscribtion, in a portion of the pipeline by using the syntax above. |
Beta Was this translation helpful? Give feedback.
I forgot to follow up on this. Ultimately the solution was quite easy, once you know about it. Ultimately a uni, can already be a sort of supplier by using either
this
Uni.createFrom().item(() -> x);
orUni.createFrom().deferred(...)
So in the end I could have, re-subscribtion, in a portion of the pipeline by using the syntax above.