Configuring Hystrix in your application

We will cover Spring Cloud Netflix Hystix with an example we discussed in the previous chapters. We will use the same example and implement the circuit-breaker pattern, which creates a strategy against cascading failure at lower levels of services in a distributed system. We will configure Hystrix in our application of customer and Account microservices, as we discussed in the previous chapters:

  • Account microservice: This microservice will give some basic functionality to the Account entity. We will call this Account service from customer service to understand circuit-breaker. It will run on port 6060 in localhost.
  • Customer microservice: This is also a REST-based microservice where we will implement the circuit-breaker using Hystrix. The Account microservice will be invoked from this Customer microservice and we will see the fallback path once the Account service is unavailable. It will run on port 6161 in localhost.

Hystrix is monitoring methods that call the remote services for failing calls. If there is such a failure, it will open the circuit and forward the call to a fallback method. The Hystrix library will tolerate failures up to a threshold. As the threshold is reached, it opens the circuit-breaker to forward all subsequent calls to the fallback method, to prevent failure of the whole system at once and it gives a time to failure service for recovering from its  failing state to a healthy state.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.12.232