Using the @HystrixCommand Annotation

With the above dependency declared you can annotate any method (including methods defined on @Client interfaces) with the @HystrixCommand annotation and it will wrap the methods execution in a Hystrix command. For example:

Using @HystrixCommand

  1. @HystrixCommand
  2. String hello(String name) {
  3. return "Hello $name"
  4. }
This works for reactive return types such as Flowable etc. as well and the reactive type will be wrapped in a HystrixObservableCommand.

The @HystrixCommand annotation also integrates with Micronauts support for Retry Advice and Fallbacks

For information on how to customize the Hystrix thread pool, group and properties see the javadoc for @HystrixCommand.