From 3723fc62b3ad4235a268216233eedc9d8fca5b4a Mon Sep 17 00:00:00 2001 From: Mark Heckler Date: Sun, 11 Mar 2018 10:06:56 -0500 Subject: [PATCH] Updated Hystrix filter information with current usage examples --- .../src/main/asciidoc/spring-cloud-gateway.adoc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-gateway.adoc b/docs/src/main/asciidoc/spring-cloud-gateway.adoc index 1ecf1af8..efcbe6f1 100644 --- a/docs/src/main/asciidoc/spring-cloud-gateway.adoc +++ b/docs/src/main/asciidoc/spring-cloud-gateway.adoc @@ -302,7 +302,7 @@ spring: This will add `X-Response-Foo:Bar` header to the downstream response's headers for all matching requests. === Hystrix GatewayFilter Factory -The Hystrix GatewayFilter Factory takes a single `name` parameters, which is the name of the `HystrixCommand`. (More options might be added in future releases). +The Hystrix GatewayFilter Factory requires a single `name` parameter, which is the name of the `HystrixCommand`. .application.yml [source,yaml] @@ -311,7 +311,7 @@ spring: cloud: gateway: routes: - - id: hytstrix_route + - id: hystrix_route uri: http://example.org filters: - Hystrix=myCommandName @@ -319,7 +319,7 @@ spring: This wraps the remaining filters in a `HystrixCommand` with command name `myCommandName`. -The Hystrix filter takes an optional `fallbackUri` parameter. Currently, only `forward:` schemed URIs are supported. If the fallback is called, the request will be forwarded to the controller matched by the URI. +The Hystrix filter can also accept an optional `fallbackUri` parameter. Currently, only `forward:` schemed URIs are supported. If the fallback is called, the request will be forwarded to the controller matched by the URI. .application.yml @@ -329,15 +329,18 @@ spring: cloud: gateway: routes: - - id: hytstrix_route - uri: http://example.org + - id: hystrix_route + uri: lb://backing-service:8088 + predicates: + - Path=/consumingserviceendpoint filters: - name: Hystrix args: name: fallbackcmd - fallbackUri: forward:/fallbackcontroller + fallbackUri: forward:/incaseoffailureusethis + - RewritePath=/consumingserviceendpoint, /backingserviceendpoint ---- -This will forward to the `/fallbackcontroller` when the Hystrix fallback is called. +This will forward to the `/incaseoffailureusethis` URI when the Hystrix fallback is called. Note that this example also demonstrates (optional) Spring Cloud Netflix Ribbon load-balancing via the `lb` prefix on the destination URI. === PrefixPath GatewayFilter Factory