コード例 #1
0
        public setBaseMsgCommand(string name, string birthday, string des, string gender, string deviceID)
            : base(HystrixCommandSetter.WithGroupKey("KMBAT")
                   .AndCommandKey("setBaseMsg")
                   .AndCommandPropertiesDefaults(
                       new HystrixCommandPropertiesSetter()

                       //使用线程池隔离模式
                       .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Thread)
                       //执行超时则打断
                       .WithExecutionIsolationThreadInterruptOnTimeout(true)
                       //执行超时时间(100毫秒)
                       .WithExecutionIsolationThreadTimeoutInMilliseconds(5000)

                       //当在配置时间窗口内达到此数量的失败后,进行断开。默认20个)
                       .WithCircuitBreakerRequestVolumeThreshold(10)
                       //出错百分比阈值,当达到此阈值后,开始短路。默认50%
                       .WithCircuitBreakerErrorThresholdPercentage(50)
                       //多久以后开始尝试是否恢复,默认5s)
                       .WithCircuitBreakerSleepWindow(TimeSpan.FromSeconds(5))
                       ))
        {
            this.name     = name;
            this.birthday = birthday;
            this.des      = des;
            this.gender   = gender;
            this.deviceID = deviceID;
        }
コード例 #2
0
        public WriteTrackLogCommand(ITrackLogLogAppender LogAppender, string CollectName, object log)
            : base(HystrixCommandSetter.WithGroupKey("Log")
                   .AndCommandKey("WriteTrackLog")
                   .AndCommandPropertiesDefaults(
                       new HystrixCommandPropertiesSetter()

                       //使用线程池隔离模式
                       .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Thread)
                       //执行超时则打断
                       .WithExecutionIsolationThreadInterruptOnTimeout(true)
                       //执行超时时间(100毫秒)
                       .WithExecutionIsolationThreadTimeoutInMilliseconds(100)

                       //当在配置时间窗口内达到此数量的失败后,进行断开。默认20个)
                       .WithCircuitBreakerRequestVolumeThreshold(10)
                       //出错百分比阈值,当达到此阈值后,开始短路。默认50%
                       .WithCircuitBreakerErrorThresholdPercentage(50)
                       //多久以后开始尝试是否恢复,默认5s)
                       .WithCircuitBreakerSleepWindow(TimeSpan.FromSeconds(10))
                       ))
        {
            this.LogAppender = LogAppender;
            this.CollectName = CollectName;
            this.log         = log;
        }
コード例 #3
0
 public TestCommand(string value, bool fail, bool failOnFallback)
     : base(HystrixCommandSetter
            .WithGroupKey("RequestLogTestCommand"))
 {
     this.value          = value;
     this.fail           = fail;
     this.failOnFallback = failOnFallback;
 }
コード例 #4
0
 public GetCurrentTimeCommand()
     : base(HystrixCommandSetter.WithGroupKey("TimeGroup")
            .AndCommandKey("GetCurrentTime")
            .AndCommandPropertiesDefaults(
                new HystrixCommandPropertiesSetter()
                .WithExecutionIsolationThreadTimeout(TimeSpan.FromSeconds(1.0))
                .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore)
                .WithExecutionIsolationThreadInterruptOnTimeout(true)))
 {
 }
コード例 #5
0
        public HystrixCommandSetter BuildCommandSettings(Type type)
        {
            var key = type.Name;

            return(HystrixCommandSetter.WithGroupKey(key)
                   .AndCommandKey(key)
                   .AndCommandPropertiesDefaults(
                       new HystrixCommandPropertiesSetter()
                       .WithExecutionIsolationThreadTimeout(TimeSpan.FromSeconds(1.0))
                       .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore)
                       .WithExecutionIsolationThreadInterruptOnTimeout(true)));
        }
コード例 #6
0
        public pullCommand(string sessionID) : base(HystrixCommandSetter.WithGroupKey("KMBAT")
                                                    .AndCommandKey("pull")
                                                    .AndCommandPropertiesDefaults(
                                                        new HystrixCommandPropertiesSetter()

                                                        //使用线程池隔离模式
                                                        .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Thread)
                                                        //执行超时则打断
                                                        .WithExecutionIsolationThreadInterruptOnTimeout(true)
                                                        //执行超时时间(100毫秒)
                                                        .WithExecutionIsolationThreadTimeoutInMilliseconds(5000)

                                                        //当在配置时间窗口内达到此数量的失败后,进行断开。默认20个)
                                                        .WithCircuitBreakerRequestVolumeThreshold(10)
                                                        //出错百分比阈值,当达到此阈值后,开始短路。默认50%
                                                        .WithCircuitBreakerErrorThresholdPercentage(50)
                                                        //多久以后开始尝试是否恢复,默认5s)
                                                        .WithCircuitBreakerSleepWindow(TimeSpan.FromSeconds(5))
                                                        ))
        {
            this.sessionID = sessionID;
        }
コード例 #7
0
ファイル: WriteDebugLogCommand.cs プロジェクト: radtek/XuHos
        public WriteDebugLogCommand(string info, Exception ex)
            : base(HystrixCommandSetter.WithGroupKey("Log")
                   .AndCommandKey("WriteDebugLog")
                   .AndCommandPropertiesDefaults(
                       new HystrixCommandPropertiesSetter()

                       //使用线程池隔离模式
                       .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Thread)
                       //执行超时则打断
                       .WithExecutionIsolationThreadInterruptOnTimeout(true)
                       //执行超时时间(100毫秒)
                       .WithExecutionIsolationThreadTimeoutInMilliseconds(100)

                       //当在配置时间窗口内达到此数量的失败后,进行断开。默认20个)
                       .WithCircuitBreakerRequestVolumeThreshold(10)
                       //出错百分比阈值,当达到此阈值后,开始短路。默认50%
                       .WithCircuitBreakerErrorThresholdPercentage(50)
                       //多久以后开始尝试是否恢复,默认5s)
                       .WithCircuitBreakerSleepWindow(TimeSpan.FromSeconds(10))
                       ))
        {
            this.info = info;
            this.ex   = ex;
        }
コード例 #8
0
        public msgPushCommand(string OrderID, string FromAccountId, string ToAlias, string Content) : base(HystrixCommandSetter.WithGroupKey("KMBAT")
                                                                                                           .AndCommandKey("msgPush")
                                                                                                           .AndCommandPropertiesDefaults(
                                                                                                               new HystrixCommandPropertiesSetter()

                                                                                                               //使用线程池隔离模式
                                                                                                               .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Thread)
                                                                                                               //执行超时则打断
                                                                                                               .WithExecutionIsolationThreadInterruptOnTimeout(true)
                                                                                                               //执行超时时间(100毫秒)
                                                                                                               .WithExecutionIsolationThreadTimeoutInMilliseconds(5000)

                                                                                                               //当在配置时间窗口内达到此数量的失败后,进行断开。默认20个)
                                                                                                               .WithCircuitBreakerRequestVolumeThreshold(10)
                                                                                                               //出错百分比阈值,当达到此阈值后,开始短路。默认50%
                                                                                                               .WithCircuitBreakerErrorThresholdPercentage(50)
                                                                                                               //多久以后开始尝试是否恢复,默认5s)
                                                                                                               .WithCircuitBreakerSleepWindow(TimeSpan.FromSeconds(5))
                                                                                                               ))
        {
            this.Content       = Content;
            this.FromAccountId = FromAccountId;
            this.ToAlias       = ToAlias;
            this.OrderID       = OrderID;
        }
コード例 #9
0
 public HandleMessageHystrixCommand(Middleware <HandleContext> actualHandle, Execution <HandleContext> context, HystrixCommandSetter hystrixCfg)
     : base(hystrixCfg)
 {
     this.actualHandle = actualHandle;
     this.context      = context;
 }