Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Hystrix Command annotation work in the application

When I annotated a method with @HystrixCommand Annotation then how is it working

@HystrixCommand(fallbackMethod="getfallBackdisplayDoctorsAndProducts_lipid",
            commandProperties= {
                @HystrixProperty(name="execution.isolation.thread.timeoutInMilliseconds",value="150"),
                    @HystrixProperty(name="circuitBreaker.requestVolumeThreshold",value="25"),
                    @HystrixProperty(name="circuitBreaker.errorThresholdPercentage",value="50"),
                    @HystrixProperty(name="circuitBreaker.sleepWindowInMilliseconds",value="5000")
            })
    public List<DoctorsAndProducts> displayDoctorsAndProducts(LipidProfile lipidProfile)
    {

    }
like image 816
NafazBenzema Avatar asked May 21 '26 05:05

NafazBenzema


1 Answers

enter image description here

  1. You have your API class and the method inside the API class which is annotated with @HystrixCommand.

  2. Hystrix wraps your API class in a proxy class.

  3. When you ask an instance of API class then the instance of the proxy class will be gotten

  4. The proxy class contains the circuit breaker logics.

  5. When somebody makes a call Hystrix is constantly monitoring that what is returning back.

  6. Proxy class - > get a call and passing to the actual method in the API class and get the response back and examining make sure and returning back.

    7.When things fail then the proxy class call fallback method until recovery back.

like image 118
NafazBenzema Avatar answered May 24 '26 02:05

NafazBenzema



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!