Using Hystrix

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.

Examples reference: chapter11/customer-gateway-hystrix.

Firstly, we are going to add Hystrix dependency to the pom.xml:

(...)<dependency>    <groupId></groupId>    <artifactId>hystrix-core</artifactId>    <version>${version.hystrix}</version></dependency>(...)

The circuit breaker command is implemented by extending the class. Let's take a look at its usage at the concrete example of our PricingProxy:

(...)@ApplicationScopedpublic ...

Get Hands-On Cloud Development with WildFly now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.