HystrixObservableCommand.Setter properties = HystrixObservableCommand.Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey("TestKey")) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD) .withExecutionTimeoutInMilliseconds(50));
HystrixObservableCommand.Setter properties = HystrixObservableCommand.Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey("TestKey")) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionTimeoutInMilliseconds(50));
HystrixObservableCommand.Setter properties = HystrixObservableCommand.Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey("TestKey")) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD) .withExecutionTimeoutInMilliseconds(50));
HystrixCommandProperties.Setter cacheCommandProps = HystrixCommandProperties.Setter(); cacheCommandProps.withExecutionIsolationThreadTimeoutInMilliseconds(DEFAULT_CACHE_TIMEOUT); cacheSetter.andCommandPropertiesDefaults(cacheCommandProps); if (setter != null) { this.setter = setter; commandProps.withExecutionIsolationSemaphoreMaxConcurrentRequests(concurrentRequestLimit); this.setter.andCommandPropertiesDefaults(commandProps);
public Setter getSetter() { Setter setterToUse; if (this.setter != null) { setterToUse = this.setter; } else { String groupNameToUse; if (StringUtils.hasText(this.groupName)) { groupNameToUse = this.groupName; } else { groupNameToUse = commandName + "group"; } HystrixCommandGroupKey groupKey = HystrixCommandGroupKey.Factory.asKey(groupNameToUse); HystrixCommandKey commandKey = HystrixCommandKey.Factory.asKey(this.commandName); HystrixCommandProperties.Setter commandProperties = this.commandProperties != null ? this.commandProperties : HystrixCommandProperties.Setter(); setterToUse = Setter.withGroupKey(groupKey).andCommandKey(commandKey) .andCommandPropertiesDefaults(commandProperties); } return setterToUse; }
/** * @param request the request to execute * @param observable the observable that emits the response for this request (created with one of the * CaravanHttpClient implementations) * @param fallback the fallback response to emit if the original request fails */ public HttpHystrixCommand(CaravanHttpRequest request, Observable<CaravanHttpResponse> observable, Observable<CaravanHttpResponse> fallback) { super(Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey(GROUP_KEY)) .andCommandKey(HystrixCommandKey.Factory.asKey(StringUtils.defaultString(request.getServiceId(), "UNKNOWN"))) .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(getIsolationStrategy(request)) .withExecutionIsolationSemaphoreMaxConcurrentRequests(10000))); this.request = request; this.observable = observable; this.fallback = fallback; }
@Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); BizkeeperCommand command = new ConsumerBizkeeperCommand(groupname, invocation, HystrixObservableCommand.Setter .withGroupKey(CommandKey.toHystrixCommandGroupKey(groupname, invocation)) .andCommandKey(CommandKey.toHystrixCommandKey(groupname, invocation)) .andCommandPropertiesDefaults(setter)); return command; } }
@Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(false) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); BizkeeperCommand command = new ProviderBizkeeperCommand(groupname, invocation, HystrixObservableCommand.Setter .withGroupKey(CommandKey.toHystrixCommandGroupKey(groupname, invocation)) .andCommandKey(CommandKey.toHystrixCommandKey(groupname, invocation)) .andCommandPropertiesDefaults(setter)); return command; } }
@Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(false) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); BizkeeperCommand command = new ProviderBizkeeperCommand(groupname, invocation, HystrixObservableCommand.Setter .withGroupKey(CommandKey.toHystrixCommandGroupKey(groupname, invocation)) .andCommandKey(CommandKey.toHystrixCommandKey(groupname, invocation)) .andCommandPropertiesDefaults(setter)); return command; } }
@Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); BizkeeperCommand command = new ConsumerBizkeeperCommand(groupname, invocation, HystrixObservableCommand.Setter .withGroupKey(CommandKey.toHystrixCommandGroupKey(groupname, invocation)) .andCommandKey(CommandKey.toHystrixCommandKey(groupname, invocation)) .andCommandPropertiesDefaults(setter)); return command; } }
public HystrixObservableCommand.Setter buildObservableCommandSetter() { HystrixObservableCommand.Setter setter = HystrixObservableCommand.Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey)) .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)); try { setter.andCommandPropertiesDefaults(HystrixPropertiesManager.initializeCommandProperties(commandProperties)); } catch (IllegalArgumentException e) { throw new HystrixPropertyException("Failed to set Command properties. " + getInfo(), e); } return setter; }
public HystrixBeanFaultTolerance(HystrixCommandKey commandKey, HystrixCommandGroupKey groupKey) { observableSettings = Setter.withGroupKey(groupKey) .andCommandKey(commandKey) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE)); commandSettings = com.netflix.hystrix.HystrixCommand.Setter.withGroupKey(groupKey) .andCommandKey(commandKey) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD)); }
.withGroupKey(groupKey) .andCommandKey(commandKey) .andCommandPropertiesDefaults(propertiesSetter);
@Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); BizkeeperCommand command = new ConsumerBizkeeperCommand(groupname, invocation, HystrixObservableCommand.Setter .withGroupKey(CommandKey.toHystrixCommandGroupKey(groupname, invocation)) .andCommandKey(CommandKey.toHystrixCommandKey(groupname, invocation)) .andCommandPropertiesDefaults(setter)); return command; } }
@Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(false) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); BizkeeperCommand command = new ProviderBizkeeperCommand(groupname, invocation, HystrixObservableCommand.Setter .withGroupKey(CommandKey.toHystrixCommandGroupKey(groupname, invocation)) .andCommandKey(CommandKey.toHystrixCommandKey(groupname, invocation)) .andCommandPropertiesDefaults(setter)); return command; } }
public HystrixObservableCommand.Setter buildObservableCommandSetter() { HystrixObservableCommand.Setter setter = HystrixObservableCommand.Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey)) .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)); try { setter.andCommandPropertiesDefaults(HystrixPropertiesManager.initializeCommandProperties(commandProperties)); } catch (IllegalArgumentException e) { throw new HystrixPropertyException("Failed to set Command properties. " + getInfo(), e); } return setter; }
protected AsynchronousObservableCommand() { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("GROUP")) .andCommandKey(HystrixCommandKey.Factory.asKey("AsyncObservable")) .andCommandPropertiesDefaults(new HystrixCommandProperties.Setter().withExecutionIsolationSemaphoreMaxConcurrentRequests(1000)) ); }
protected SynchronousObservableCommand() { super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("GROUP")) .andCommandKey(HystrixCommandKey.Factory.asKey("SyncObservable")) .andCommandPropertiesDefaults(new HystrixCommandProperties.Setter().withExecutionIsolationSemaphoreMaxConcurrentRequests(1000)) ); }