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 method’s execution will be wrapped 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 reactor:Flux[], and the reactive type will be wrapped in a HystrixObservableCommand.

The HystrixCommand annotation also integrates with Micronaut’s support for Retry Advice and Fallbacks

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