add gateway timeout message
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-04-11 14:51:39 +02:00
parent f7764b21d9
commit 72e722f9e5
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
3 changed files with 23 additions and 13 deletions

View File

@ -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/(?<SAMPLEID>.*)", "/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/(?<RESULTID>.*)", "/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/(?<DATEAFTER>.*)", "/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/(?<DATEBEFORE>.*)", "/result/before/\${DATEBEFORE}")
}

View File

@ -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<Any?>(HttpStatus.GATEWAY_TIMEOUT)
}
}

View File

@ -1,13 +0,0 @@
management:
endpoints:
web:
exposure:
include: hystrix.stream
hystrix:
command:
fallbackcmd:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000