title: How to get spring-cloud zuul to use a different circuit for different services
body: <p>I'm attempting to use spring-cloud-starter-zuul.  I have setup Eureka and registered a simple service I wrote as a Eureka client.  I register two instances on two different hosts with two different application names so they are two different services in Eureka.  My objective is to ensure that if serviceA is performing well and serviceB is performing poorly that proxying to serviceA is not affected by failure to proxy to serviceB.</p>
  
  <p>If I run load test serviceA alone through zuul I'm able to maintain my 400 TPS throughput without a problem. If I then throw in serviceB and totally overload it and have it timing out all over the place, I would expect serviceA to continue at 400 while serviceB flounders, but instead serviceA drops to less than 50 TPS success rate and has a bunch of errors as well.</p>
  
  <p>It appears that all of the RibbonCommands spawned by the RibbonRoutingFilter share the same circuit in hystrix, which makes no sense to me.  Looking in the RibbonRoutingFilter where it creates the RibbonCommand, I don't see any way to configure it to use a different one.</p>
  
  <p>In RibbonRoutingFilter:</p>
  
  <pre><code>    RibbonCommand command = new RibbonCommand(restClient, verb, uri,
              convertHeaders(headers), convertHeaders(params), requestEntity);
  </code></pre>
  
  <p>I have validated that the restClient is different for serviceA and serviceB, so they are using their own connection pool configuration as I've specified in the application.yml file, but there is still a ton of cross-contamination in service quality between serviceA and serviceB.</p>
  
  <p>There appears to be another constructor for RibbonCommand that takes a "commandKey" as a first parameter, and the one I reference simply delegates to that one with a commandKey value of "default".  I see no switches or options to override that in the RibbonRoutingFilter.  To me this seriously compromises the viability of Zuul when used from the spring-cloud project.</p>
  
  <p><strong>Is there a way for me to configure this out of the box so that each service has its own circuit?</strong></p>
  
  <p>Applicable portions of my pom:</p>
  
  <pre><code>&lt;dependencyManagement&gt;
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
        &lt;artifactId&gt;spring-cloud-starter-parent&lt;/artifactId&gt;
        &lt;version&gt;1.0.0.RC1&lt;/version&gt;
        &lt;type&gt;pom&lt;/type&gt;
        &lt;scope&gt;import&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
      &lt;artifactId&gt;spring-cloud-starter&lt;/artifactId&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
      &lt;artifactId&gt;spring-cloud-starter-zuul&lt;/artifactId&gt;
    &lt;/dependency&gt;
  </code></pre>
  
  <p>application.yml:</p>
  
  <pre><code>ribbon:
    ConnectTimeout: 5000
    ReadTimeout: 5000
    MaxAutoRetries: 0
    MaxAutoRetriesNextServer: 0
    OkToRetryOnAllOperations: false
    MaxHttpConnectionsPerHost: 200
    MaxTotalHttpConnections: 1000
  echo1:
    ribbon:
      ActiveConnectionsLimit: 200
  echo2:
    ribbon:
      ActiveConnectionsLimit: 400
  spring:
    application:
      name: SpringCloudProxywall
  server:
    port: 8080
  zuul:
    routes:
      echo1:
        path: /echo1/**
        serviceId: echo1
        stripPrefix: false
      echo2:
        path: /echo2/**
        serviceId: echo2
        stripPrefix: false
  </code></pre>
  
  <p>My application class:</p>
  
  <pre><code>@Configuration
  @ComponentScan
  //@EnableCircuitBreaker  &lt;-- is already included in EnableZuulProxy
  @EnableZuulProxy
  @EnableTurbine
  @EnableHystrixDashboard
  @EnableAutoConfiguration
  public class SpringCloudProxywallApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(SpringCloudProxywallApplication.class, args);
      }
  }
  </code></pre>