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
@HystrixCommand
String hello(String name) {
return "Hello $name"
}
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. |