Search code examples
springspring-bootspring-cloudnetflix-eurekanetflix-zuul

Using Hystrix Stream in Zuul with Eureka First to find Config server


I'm using spring cloud Brixton.M4 with spring boot 1.3.1

I have zuul server with

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-netflix-hystrix-stream</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
    </dependency>

and i'm using Eureka first to find Config-Server so bootstrap looks like

spring:
 profiles: dev 
 cloud:
   config:
     fail-fast: true
     discovery:
       enabled: true
       serviceId: config-server

zuul is registring two time first with UP state then with STARTING

2016-01-18 14:47:27.209  INFO 2808 --- [           main] c.w.i.edgeserver.EdgeServerApplication   : Started EdgeServerApplication in 21.651 seconds (JVM running for 22.232)
2016-01-18 14:47:56.231  INFO 2808 --- [ool-20-thread-1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003 - Re-registering apps/EDGE-SERVER
2016-01-18 14:47:56.270  INFO 2808 --- [ool-20-thread-1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003: registering service...
2016-01-18 14:47:56.281  INFO 2808 --- [ool-20-thread-1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003 - registration status: 204
2016-01-18 14:48:06.230  INFO 2808 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003: registering service...
2016-01-18 14:48:06.238  INFO 2808 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_EDGE-SERVER/192.168.17.178:edge-server:8003 - registration status: 204

If I remove dependency on config-server by setting

spring:
 profiles: dev 
 cloud:
   config:
     fail-fast: false
     discovery:
       enabled: false
       serviceId: config-server

everything runs fine.


Solution

  • That's normal I think (the bootstrap phase has to register to get the configserver location, and then unregister to let the main application register again). You will probably find that it settles back to UP after the application has started up fully.