diff --git a/src/main/kotlin/com/kmlabz/birbnetes/apigateway/ApiGatewayConfig.kt b/src/main/kotlin/com/kmlabz/birbnetes/apigateway/ApiGatewayConfig.kt index c209a1b..59cc3fe 100644 --- a/src/main/kotlin/com/kmlabz/birbnetes/apigateway/ApiGatewayConfig.kt +++ b/src/main/kotlin/com/kmlabz/birbnetes/apigateway/ApiGatewayConfig.kt @@ -17,6 +17,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "input-service-sample" + config.setFallbackUri("forward:/fallback") } .rewritePath("/api/input/v1/sample", "/sample") } @@ -27,6 +28,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "input-service-query" + config.setFallbackUri("forward:/fallback") } .rewritePath("/api/input/v1/sample/(?.*)", "/sample/\${SAMPLEID}") } @@ -37,6 +39,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "output-service-result" + config.setFallbackUri("forward:/fallback") } .rewritePath("//api/output/v1/result", "/result") } @@ -47,6 +50,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "output-service-query" + config.setFallbackUri("forward:/fallback") } .rewritePath("/api/output/v1/result/(?.*)", "/result/\${RESULTID}") } @@ -57,6 +61,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "output-service-negative" + config.setFallbackUri("forward:/fallback") } .rewritePath("/api/output/v1/result/filter/negative", "/result/filter/negative") } @@ -67,6 +72,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "output-service-positive" + config.setFallbackUri("forward:/fallback") } .rewritePath("/api/output/v1/result/filter/positive", "/result/filter/positive") } @@ -77,6 +83,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "output-service-after" + config.setFallbackUri("forward:/fallback") } .rewritePath("/api/output/v1/result/after/(?.*)", "/result/after/\${DATEAFTER}") } @@ -87,6 +94,7 @@ class ApiGatewayConfig { .filters { f -> f .hystrix { config -> config.name = "output-service-before" + config.setFallbackUri("forward:/fallback") } .rewritePath("/api/output/v1/result/before/(?.*)", "/result/before/\${DATEBEFORE}") } diff --git a/src/main/kotlin/com/kmlabz/birbnetes/apigateway/ApiGatewayController.kt b/src/main/kotlin/com/kmlabz/birbnetes/apigateway/ApiGatewayController.kt new file mode 100644 index 0000000..7b061b0 --- /dev/null +++ b/src/main/kotlin/com/kmlabz/birbnetes/apigateway/ApiGatewayController.kt @@ -0,0 +1,15 @@ +package com.kmlabz.birbnetes.apigateway + +import org.springframework.http.HttpStatus +import org.springframework.http.ResponseEntity +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + + +@RestController +class ApiGatewayController { + @RequestMapping("/fallback") + fun fallback(): ResponseEntity<*>? { + return ResponseEntity(HttpStatus.GATEWAY_TIMEOUT) + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml deleted file mode 100644 index 2046add..0000000 --- a/src/main/resources/application.yml +++ /dev/null @@ -1,13 +0,0 @@ -management: - endpoints: - web: - exposure: - include: hystrix.stream - -hystrix: - command: - fallbackcmd: - execution: - isolation: - thread: - timeoutInMilliseconds: 3000 \ No newline at end of file