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