当前位置: 首页 > 知识库问答 >
问题:

Spring Cloud Zuul断路器所有通过TurbineStream而不是Turbin-AMQP的路线

张砚
2023-03-14

我使用的是spring boot 1.3.1和spring cloudl Brixtom.m4,而使用springboot 1.3.1时,我发现Turbane-AMQP项目不再可用,取而代之的是spring Turbany Stream项目。我用rabbitmq或kafka来使用SpringTurbin,想要监视所有在Zuul注册的路线的hystrix流,我可以看到Zuul的hystrix.stream,也可以看到hystrix仪表板中的hystrix.stream,但不确定如何使用SpringTurbine流。我在网上找到了使用涡轮AMQP的代码和文档。

我有zuul服务器运行ad 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>

和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,它会出错。

我做错了什么?

共有1个答案

滕璞瑜
2023-03-14

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

 类似资料:
  • 我正在使用Spring Cloud和@EnableZuulProxy,是否可以通过/hystrix.stream使用hystrix监视application.yml中配置的所有路由?在下面的示例中,我希望有一个简单的方法来监视所有对下游产品服务的请求。我理解我可以在产品服务本身上做到这一点,但是否有可能监视Zuul请求。这对于任何非自有(第三方)且不能用@hystrixcommand注释的下游服务

  • 我想创建一个到RabbitMQ的Openshift路径。 据我了解https://docs.openshift.com/container-platform/3.11/architecture/networking/routes.html,“TLS with SNI”支持应该能够检查SNI标头,然后将流量路由到适当的服务。 不幸的是,我在边缘终止和重新加密终止方面都遇到了问题。在这两种情况下,HA

  • 我在我的spring boot应用程序中使用Hystrix实现断路器,我的代码如下所示: 我看到每次失败时都会调用fallback()。但3次故障后电路不开。在3次失败之后,我原以为它会直接调用并跳过。但这并没有发生。有人能告诉我我在这里做错了什么吗? 谢谢,B Jagan 下面是实际代码。我用这个玩得更远了。当我在RegistrationHystrix.RegisterSeller()方法中直接

  • 注:本节未经校验,如有问题欢迎提issue 为什么使用它们? 线路断路器用于提供稳定性并防止在分布式系统中的级联故障。它们应该结合在远程系统之间的接口使用明智的超时,以防止单个组件的故障拖垮所有组件。 作为一个例子,我们有一个web 应用程序与远程的第三方web服务进行交互。假如第三方已用完了他们的容量,他们的数据库也在高荷载作用下熔化。假设数据库在这种情况下失败,第三方 web 服务用了很长的时

  • 我的想法: 回溯解决方案,我们通过所有解决方案的树和打印,一旦我们达到目标单元格。我实现了这一点,但我不确定它是否正确或有意义,或者它是否是正确的方法。我在这里发布了代码,如果有人能解释它的错误,我将非常感谢。 递归解决方案,我从起始单元格开始,并从每个相邻单元格递归地找到目标单元格的路径,基本情况是击中目标单元格。 5)有没有更简单的方法来做到这一点? 下面是我的代码,它打印N=4的正确路径数。

  • 我正在尝试春云和春靴。它使用了Netflix的OSS应用程序,其中有Ribbon和Hystrix。 Ribbon是一个负载均衡器,带有一些功能,其中一个是断路器。