当前位置: 代码迷 >> 综合 >> Unable to connect to Command Metric Stream.
  详细解决方案

Unable to connect to Command Metric Stream.

热度:25   发布时间:2024-02-21 08:37:01.0
学习Cloud搭建HystrixDashboard仪表盘中的小坑。由于Hystrix不更新的,所以2.2版本的Spring对它没做好兼容。要自己在生产者的启动类改造:

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@EnableHystrix
@EnableCircuitBreaker
public class CirculateMain {
    public static void main(String[] args) {
    SpringApplication.run(CirculateMain.class, args);}@Beanpublic ServletRegistrationBean getServlet(){
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);registrationBean.setLoadOnStartup(1);registrationBean.addUrlMappings("/hystrix.stream");registrationBean.setName("HystrixMetricsStreamServlet");return registrationBean;}}
  相关解决方案