From e6e821acd9d83ec3482da83a9d3e90d57f632a9f Mon Sep 17 00:00:00 2001 From: Matt Nelson Date: Mon, 5 Oct 2015 14:24:18 -0500 Subject: [PATCH] Support RibbonCommand group key parameter --- .../ribbon/hystrix/RibbonCommand.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/zuul-netflix/src/main/java/com/netflix/zuul/dependency/ribbon/hystrix/RibbonCommand.java b/zuul-netflix/src/main/java/com/netflix/zuul/dependency/ribbon/hystrix/RibbonCommand.java index 1c8c938900..99deeab3e2 100644 --- a/zuul-netflix/src/main/java/com/netflix/zuul/dependency/ribbon/hystrix/RibbonCommand.java +++ b/zuul-netflix/src/main/java/com/netflix/zuul/dependency/ribbon/hystrix/RibbonCommand.java @@ -4,6 +4,7 @@ import com.netflix.client.http.HttpResponse; import com.netflix.config.DynamicPropertyFactory; import com.netflix.hystrix.HystrixCommand; +import com.netflix.hystrix.HystrixCommandKey; import com.netflix.hystrix.HystrixCommandGroupKey; import com.netflix.hystrix.HystrixCommandProperties; import com.netflix.niws.client.http.RestClient; @@ -53,13 +54,25 @@ public RibbonCommand(String commandKey, MultivaluedMap params, InputStream requestEntity) throws URISyntaxException { - super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(commandKey)).andCommandPropertiesDefaults( - // we want to default to semaphore-isolation since this wraps - // 2 others commands that are already thread isolated - HystrixCommandProperties.Setter().withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE) - .withExecutionIsolationSemaphoreMaxConcurrentRequests(DynamicPropertyFactory.getInstance(). - getIntProperty(ZuulConstants.ZUUL_EUREKA + commandKey + ".semaphore.maxSemaphores", 100).get()))); - + this("default", RibbonCommand.class.getSimpleName(), restClient, verb, uri, headers, params, requestEntity); + } + + public RibbonCommand(String groupKey, + String commandKey, + RestClient restClient, + Verb verb, + String uri, + MultivaluedMap headers, + MultivaluedMap params, + InputStream requestEntity) throws URISyntaxException { + + super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey)).andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)).andCommandPropertiesDefaults( + // we want to default to semaphore-isolation since this wraps + // 2 others commands that are already thread isolated + HystrixCommandProperties.Setter().withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE) + .withExecutionIsolationSemaphoreMaxConcurrentRequests(DynamicPropertyFactory.getInstance(). + getIntProperty(ZuulConstants.ZUUL_EUREKA + commandKey + ".semaphore.maxSemaphores", 100).get()))); + this.restClient = restClient; this.verb = verb; this.uri = new URI(uri);