Service Discovery
- Service Discovery Using Eureka
- Spring Cloud - Creating Eureka Server
- Spring Cloud - Creating Eureka Client
- Eureka Client Consumer Example
- Spring Cloud - Eureka Server API
- Spring Cloud - Eureka High Availablity
- Spring Cloud - Eureka Zone Awareness
Synchronous Communication
- Synchronous Communication with Feign Client
- Spring Cloud - Feign Client with Eureka
- Spring Cloud - Testing Feign Client
Synchronous Communication
- Spring Cloud - Gateway
- Spring Cloud - Creating Gateway Application
- Spring Cloud - Testing Gateway Application
- Spring Cloud - Monitoring Gateway Application
Miscellaneous
- Spring Cloud - Load Balancer
- Circuit Breaker using Hystrix
- Streams with Apache Kafka
- Distributed Logging using ELK and Sleuth
Spring Cloud Useful Resources
Spring Cloud - Monitoring Gateway Application
For monitoring of the Gateway or for accessing various routes, predicates, etc., we can enable the actuator in the project. For doing that, let us first update the pom.xml to contain the actuator as a dependency.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
For monitoring, we're enabling the actuator. So, here is how it would look like −
spring.application.name=restaurant-gateway-service server.port=8084 eureka.client.service-url.defaultZone=http://localhost:8761/eureka management.endpoint.gateway.access=UNRESTRICTED management.endpoints.web.exposure.include=gateway
Now, to list all the routes, we can hit: http://localhost:8084/actuator/gateway/routes
[
{
"predicate": "Paths: [/customer/**], match trailing slash: true",
"route_id": "b8f0a6a6-eb31-469c-acf0-2cb9f51f7aa1",
"filters": [],
"uri": "http://localhost:8080/customer-service",
"order": 0
},
{
"predicate": "Paths: [/restaurant/**], match trailing slash: true",
"route_id": "18b0ba68-3533-412c-b138-bc61b5b48e18",
"filters": [],
"uri": "http://localhost:8080/restaurant-service",
"order": 0
}
]
Other important APIs for monitoring −
| API | Description |
|---|---|
| GET /actuator/gateway/routes/{id} | Get information about a particular route |
| POST /gateway/routes/{id_to_be assigned} | Add a new route to the Gateway |
| DELETE /gateway/routes/{id} | Remove the route from Gateway |
| POST /gateway/refresh | Remove all the cache entries |
Advertisements