gpt4 book ai didi

java - Spring Cloud Zuul CircuitBreaker 所有路由都通过 TurbineStream 而不是 Turbine-AMQP

转载 作者:行者123 更新时间:2023-11-30 08:42:06 25 4
gpt4 key购买 nike

我正在使用 spring boot 1.3.1 和 spring cloudl Brixtom.M4,在使用 springboot 1.3.1 时我发现 Turbine-AMQP 项目不再可用,我们现在有了 Spring Turbine Stream 项目。我用 rabbitmq 或 kafka 使用 SpringTurbine 并想监视在 Zuul 中注册的所有路由的 hystrix 流,我能够看到 zuul 的 hystrix.stream 并且也能够在 hystrix 仪表板中看到它,但不知道如何使用 Spring 涡轮流。在网上我找到了使用 Turbine AMQP 的代码和文档。

我有 zuul 服务器运行广告 http://localhost:9003/有依赖性

 <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

和 main.java 作为

@SpringBootApplication
@EnableZuulProxy
@EnableCircuitBreaker
public class EdgeServerApplication {

public static void main(String[] args) {
SpringApplication.run(EdgeServerApplication.class, args);
}
}

我还有 springTurbinestream 项目作为

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

org.springframework.boot Spring 启动启动器执行器

和 TurbineStream 的主类作为

@SpringBootApplication
@EnableTurbineStream
@EnableDiscoveryClient
public class WiziqTurbineApplication {

public static void main(String[] args) {
SpringApplication.run(WiziqTurbineApplication.class, args);
}
}

当我运行应用程序并转到 http://localhost:9003/hystrix.stream 时我看到了流但是如果我去 http://localhost:9003/turbine.stream它出错了。

我做错了什么?

最佳答案

您的客户端应用程序(在端口 9003 上)不应该有 /turbine.stream。它应该将带有 hystrix 指标的消息发送给 rabbit(例如)。为此,您需要添加 spring-cloud-netflix-hystrix-streamspring-cloud-starter-stream-rabbit(就像您在服务器上所做的那样对于 *-turbine-* 依赖项)。

关于java - Spring Cloud Zuul CircuitBreaker 所有路由都通过 TurbineStream 而不是 Turbine-AMQP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34693054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com