Check out the full series of Questions Management tutorial here.
After applying the Circuit Breaker for Questions Management using Hystrix, now is the time to build a Monitor Dashboard using Hystrix Dashboard to monitor all services call to other services. To do this, the first step is to create a new Spring Boot project with Hystrix Dashboard dependency as follows: In the New Spring Starter Project window, after entering information about our project, the Location section you need to point to the support folder of the questions-management project:
In the selection of dependencies used for the support-monitor-dashboard project, you need to select the Hystrix Dashboard as follows:
Result:
Next, I will revise this project so that it uses the parent project of project questions-management.
In the pom.xml file of this project, I will delete the current <parent>, <properties> and <dependencyManagement> sections to declare using parent project of questions-management project as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>support-monitor-dashboard</artifactId> <name>support-monitor-dashboard</name> <description>Support Monitor Dashboard for Questions Management</description> <parent> <groupId>com.huongdanjava.qm</groupId> <artifactId>questions-management</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> |
Then declare the support-monitor-dashboard project as a module of questions-management project as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.huongdanjava.qm</groupId> <artifactId>questions-management</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>Questions Management</name> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.3.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <modules> <module>core/core-category-service</module> <module>core/core-option-service</module> <module>core/core-question-service</module> <module>composite/composite-question-service</module> <module>composite/composite-option-service</module> <module>api/api-category-service</module> <module>api/api-question-service</module> <module>api/api-option-service</module> <module>support/support-discovery-server</module> <module>support/support-edge-server</module> <module>support/support-monitor-dashboard</module> </modules> </project> |