In order to learn Hystrix behavior in practice, we are going to extend customer-gateway service so that it uses Hystrix for its invocations. Later, we are going to make one of our services artificially unresponsive and see how Hystrix behaves. Let's start.
Firstly, we are going to add Hystrix dependency to the pom.xml:
(...)<dependency> <groupId>com.netflix.hystrix</groupId> <artifactId>hystrix-core</artifactId> <version>${version.hystrix}</version></dependency>(...)
The circuit breaker command is implemented by extending the com.netflix.hystrix.HystrixCommand class. Let's take a look at its usage at the concrete example of our PricingProxy:
(...)@ApplicationScopedpublic ...