hystrix -hystrixCommand配置介紹


public @interface HystrixCommand {

            // HystrixCommand 命令所屬的組的名稱:默認注解方法類的名稱
            String groupKey() default "";

            // HystrixCommand 命令的key值,默認值為注解方法的名稱
            String commandKey() default "";

            // 線程池名稱,默認定義為groupKey
            String threadPoolKey() default "";
            // 定義回退方法的名稱, 此方法必須和hystrix的執行方法在相同類中
            String fallbackMethod() default "";
            // 配置hystrix命令的參數
            HystrixProperty[] commandProperties() default {};
            // 配置hystrix依賴的線程池的參數
             HystrixProperty[] threadPoolProperties() default {};

            // 如果hystrix方法拋出的異常包括RUNTIME_EXCEPTION,則會被封裝HystrixRuntimeException異常。我們也可以通過此方法定義哪些需要忽略的異常
            Class<? extends Throwable>[] ignoreExceptions() default {};

            // 定義執行hystrix observable的命令的模式,類型詳細見ObservableExecutionMode
            ObservableExecutionMode observableExecutionMode() default ObservableExecutionMode.EAGER;

            // 如果hystrix方法拋出的異常包括RUNTIME_EXCEPTION,則會被封裝HystrixRuntimeException異常。此方法定義需要拋出的異常
            HystrixException[] raiseHystrixExceptions() default {};

            // 定義回調方法:但是defaultFallback不能傳入參數,返回參數和hystrix的命令兼容
            String defaultFallback() default "";
        }

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM