In a tutorial from youtube the author to use Spring Cloud Gateway, Hystrix, Netflix, and configure routes with application.yml, but when I try to send data from the endpoint I just hang on the Hystrix Dashboard "Loading ...", in the tutorial works well...
hystrix.stream work well, put him in Histrix dashboard and only show "loading"
I tried another tutorial, but the problem persists again!
Maven Dependencies
spring-cloud-starter-netflix-eureka-client
spring-cloud-starter-config
lombok
spring-boot-starter-data-jpa
spring-boot-starter-web
spring-cloud-starter-hystrix:2.7.3.RELEASE
<spring-cloud.version>Hoxton.SR10</spring-cloud.version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
application.yml
spring:
application:
name: API-GATEWAY
cloud:
gateway:
routes:
- id: USER-SERVICE
uri: lb://USER-SERVICE
predicates:
- Path=/user/**
filters:
- name: CircuitBreaker
args:
name: USER-SERVICE
fallbackuri: forward:/userServiceFallBack
- id: DEPARTMENT-SERVICE
uri: lb://DEPARTMENT-SERVICE
predicates:
- Path=/department/**
filters:
- name: CircuitBreaker
args:
name: DEPARTMENT-SERVICE
fallbackuri: forward:/departmentServiceFallBack
@Bean
@LoadBalanced
public RestTemplate restTemplate(){
return new RestTemplate();
}
If use @EnableCircuitBreaker working very well , the problem is use application.yml to configure spring cloud routes?
The solution is simple, API-GATEWAY where hystrix.stream is used on port 8789, and USER-SERVICE on port 9001, so you need to use the API-GATEWAY port with the user's endpoint to work the metrics.
API-GATEWAY port: 8789
USER-SERVICE port: 9001
Problem:
API-GATEWAY - http://localhost:8789/acturator/hystrix.stream
USER-SERVICE save user - http://localhost:9001/user/
Solution:
API-GATEWAY - http://localhost:8789/acturator/hystrix.stream
USER-SERVICE save user - http://localhost:8789/user/
Metrics now work well and the Hystrix Dashboard can work correctly.