I can see hystrix dashboard with : http://localhost:8081/hystrix
Also I see my circuits break and fallback methods working as well
Yet I can't see my application's data at : http://localhost:8081/actuator/hystrix.stream
When I look at /actuator/conditions I see following error for Hystrix
"HystrixAutoConfiguration.HystrixServletAutoConfiguration": {
"notMatched": [
{
"condition": "OnClassCondition",
"message": "@ConditionalOnClass did not find required class 'com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet'"
}
],
"matched": []
}
Code pom.xml
Spring Boot parent version : 2.2.6.RELEASE
Spring Cloud version : Hoxton.SR3
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
</dependencies>
application.properties
management.endpoints.web.exposure.include = hystrix.stream, conditions
MainApp
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
@EnableHystrixDashboard
@EnableHystrix
public class MovieCatalogServiceApplication {}
CatalogRestController
@RestController
@RequestMapping("/catalog")
public class CatalogRestController {
@Autowired
MovieInfoService movieInfo;
@Autowired
UserRatingsService userRatingInfo;
@RequestMapping("/{userId}")
public List<Catalog> getCatalogsByUserId(@PathVariable("userId") int userId){
UserRatings ratings = userRatingInfo.getUserRating(userId);
return ratings.getUserRatings().stream().map(oneOfRatings -> {
return movieInfo.getCatalog(oneOfRatings);
}).collect(Collectors.toList());
}
}
UserRatingsService
@Service
public class UserRatingsService {
@Autowired
private WebClient webClient;
@HystrixCommand(fallbackMethod="getFallbackUserRating")
public UserRatings getUserRating(int userId) {
return webClient
.get()
.uri("http://user-rated-movies-service/ratingsdata/users/"+ userId)
.retrieve()
.bodyToMono(UserRatings.class)
.block();
}
public UserRatings getFallbackUserRating(int userId) {
UserRatings userRatings = new UserRatings();
userRatings.setUserRatings(Arrays.asList(
new Rating("0", "fallback method of user rating", 0)
));
return userRatings;
}
}