首页 > 代码库 > 006hystrix.stream信息聚合Turbine

006hystrix.stream信息聚合Turbine

1、POM配置

  和普通Spring Boot工程相比,仅仅添加了Turbine和Spring Boot Starter Actuator依赖

<dependencies>
  <!--添加Turbine依赖-->
  <dependency>     <groupId>org.springframework.cloud</groupId>     <artifactId>spring-cloud-starter-turbine</artifactId>   </dependency>
  <!--添加Turbine依赖-->
  <dependency>     <groupId>org.springframework.cloud</groupId>     <artifactId>spring-cloud-netflix-turbine</artifactId>   </dependency>   <dependency>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-actuator</artifactId>   </dependency> </dependencies> <dependencyManagement>   <dependencies>     <dependency>       <groupId>org.springframework.cloud</groupId>       <artifactId>spring-cloud-dependencies</artifactId>       <version>Dalston.SR2</version>       <type>pom</type>       <scope>import</scope>       </dependency>   </dependencies> </dependencyManagement>

02、使能Eureka Server

@SpringBootApplication
@EnableTurbine//使能Turbine
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

03、src/main/resources工程配置文件application.yml内容如下

spring:
  application.name: turbine-service-monitoring
server:
  port: 4001
#security.basic.enabled: false
turbine:
  aggregator:
    clusterConfig: default   # 指定聚合哪些集群,多个使用","分割,默认为default。
  appConfig: ribbon-hello-service-consumer, feign-hello-service-consumer   ### 配置Eureka中的serviceId列表,表明监控哪些服务
  clusterNameExpression: new String("default")
eureka:
  client:
    serviceUrl:
      defaultZone: http://discovery:1000/eureka/

006hystrix.stream信息聚合Turbine