Giter Site home page Giter Site logo

CircuitBreaker about reactor-addons HOT 21 CLOSED

reactor avatar reactor commented on May 13, 2024
CircuitBreaker

from reactor-addons.

Comments (21)

akarnokd avatar akarnokd commented on May 13, 2024
  • L87: Sending the Subscription downstream is not recommended, looks like you wanted this.
  • L101: not really necessary unless you want to be very eager.

from reactor-addons.

smaldini avatar smaldini commented on May 13, 2024
  • The cancelled check onComplete/onError/onNext could/should be a separate non volatile boolean done.
  • cancel() could be defensive against double cancellation by checking cancelled, in fact it could be an int volatile + AtomicFieldIntegerUpdater to compareAndSet.

from reactor-addons.

smaldini avatar smaldini commented on May 13, 2024
  • I would also use a noop like Operators.error(Subscriber, Throwable) subscription for the onSubscribe error case
  • the circuitBreaker should be notified of cancel or the circuit would be permanent in some cases (e.g. someone using take(5) just after the operator)

from reactor-addons.

smaldini avatar smaldini commented on May 13, 2024
  • Eventually the circuit could collect health state from onNext and request events too (received a request at time T, received this amount of value or termination in T2).

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

Thank you for your comments. I'm not sure if I understood all of them.

  • L87 is fixed.
  • I thought L101 helps to reduce the number of requests on the childSubscriber.

The cancelled check onComplete/onError/onNext could/should be a separate non volatile boolean done.

The boolean cancelled flags are already separated and volatile? Or do you mean something else?

I would also use a noop like Operators.error(Subscriber, Throwable) subscription for the onSubscribe error case

What do you mean by Operators.error(Subscriber, Throwable). Do you have an example?
RxJava does not seem to have that feature.

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

the circuitBreaker should be notified of cancel or the circuit would be permanent in some cases (e.g. someone using take(5) just after the operator)

The CircuitBreaker is permanent which means that you should have one CircuitBreaker instance per backend system and reuse the instance to secure several streams.

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

Eventually the circuit could collect health state from onNext and request events too (received a request at time T, received this amount of value or termination in T2).

The CircuitBreaker publishes a stream of events. If a call is successful, it publishes a CircuitBreakerOnSuccessEvent and if a call fails, it publishes a CircuitBreakerOnErrorEvent.
It also publishes events about state transitions. But I don't want to publish too many events which might not be interesting for monitoring systems.

The CircuitBreaker can only be used for cold streams and not for hot streams.

from reactor-addons.

smaldini avatar smaldini commented on May 13, 2024

Cold stream of scalar volume then or basically promise/mono/single/maybe/completable.
I'd think that in RS it might be interesting to monitor active subscriptions (and so cancelling should be bridged) and their throughput using request/item-received on fixed windows.

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

Is the cancelled check onComplete/onError/onNext ok like this?

https://github.com/RobWin/javaslang-circuitbreaker/blob/master/src/main/java/io/github/robwin/circuitbreaker/operator/CircuitBreakerOperator.java#L75

https://github.com/RobWin/javaslang-circuitbreaker/blob/master/src/main/java/io/github/robwin/circuitbreaker/operator/CircuitBreakerOperator.java#L105

https://github.com/RobWin/javaslang-circuitbreaker/blob/master/src/main/java/io/github/robwin/circuitbreaker/operator/CircuitBreakerOperator.java#L138-L143

from reactor-addons.

gembin avatar gembin commented on May 13, 2024

Any progress so far?

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

@smaldini Is there any guide how to write custom Spring Reactor operators?
I tried to create a custom Reactor operator, but I failed.

from reactor-addons.

smaldini avatar smaldini commented on May 13, 2024

We folow he same guidelines as rxjava2 but we haven't done our own guide yet as we are pushing a bit more the API and toolkit until 3.1 now.
One thing tho, having at least a simplified version of such operator (if it was encapsulated as one FluxCircuitBreaker + java parameters vs custom contract) we would welcome it in core probably for Mono/Flux.

from reactor-addons.

leonard84 avatar leonard84 commented on May 13, 2024

@smaldini 3.1 is released, could we get it in now?

@RobWin I wanted to look at your attempt, but unfortunately the source code links are invalid now.

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

@leonard84 We only have a RxJava addon. See: https://github.com/resilience4j/resilience4j/tree/master/resilience4j-rxjava2/src/main/java/io/github/resilience4j
We need help add support for Reactor.

from reactor-addons.

leonard84 avatar leonard84 commented on May 13, 2024

@RobWin I saw the rxjava2 implementation. You said

We need help add support for Reactor.

but without the prototype code for the reactor support it is hard to see/fix the problems.

from reactor-addons.

simonbasle avatar simonbasle commented on May 13, 2024

@RobWin looks like this largely built on Publisher/Subscriber now, so the differences should not be that great, with limited adaptation effort.

from reactor-addons.

michael-barker avatar michael-barker commented on May 13, 2024

@RobWin Any update on this? I'd love to be able to use Reslience4j with Reactor.

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

I wont't have time to implement it, but we have RxJava2 operators which have been reviewed by @akarnokd.
If would be awesome if someone would like to contribute Reactor operators.

from reactor-addons.

michael-barker avatar michael-barker commented on May 13, 2024

I'd be willing to give it a shot but not sure I'm well versed enough in Resilience4j and Reactor.

from reactor-addons.

RobWin avatar RobWin commented on May 13, 2024

Nice. I can invite you into our slack channel if you have questions regarding Resilience4j.

from reactor-addons.

leonard84 avatar leonard84 commented on May 13, 2024

@RobWin isn't this issue redundant, as https://github.com/resilience4j/resilience4j now has a reactor module?

from reactor-addons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.