Kotlin Springgateway Circuitebreak
add dependency
- dependency library 를 추가 ```xml
- Declare circuit breaker in application.yaml
```yaml
spring:
cloud:
gateway:
routes:
- id: my_route
uri: http://localhost:8060/
filters:
- name: CircuitBreaker
args:
name: myCircuitBreaker
fallbackUri: forward:/inCaseOfFailure
- Declare the endpoint which will be called in the case of failure (a connection error, for example)
@RequestMapping("/inCaseOfFailure") public Mono<ResponseEntity<String>> inCaseOfFailureUseThis() { return Mono.just(ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body("body for service failure case")); }
댓글남기기