From 08a5f8b2de9f97a6b31a0d909f79930eada0eca9 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Tue, 21 Jan 2020 23:39:32 -0500 Subject: [PATCH] Removes hystrix and ribbon references --- .../main/asciidoc/spring-cloud-gateway.adoc | 106 ------------------ .../src/test/resources/application.yml | 38 ------- 2 files changed, 144 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-gateway.adoc b/docs/src/main/asciidoc/spring-cloud-gateway.adoc index 57f96cbd..8715209f 100644 --- a/docs/src/main/asciidoc/spring-cloud-gateway.adoc +++ b/docs/src/main/asciidoc/spring-cloud-gateway.adoc @@ -565,112 +565,6 @@ This removes duplicate values of `Access-Control-Allow-Credentials` and `Access- The `DedupeResponseHeader` filter also accepts an optional `strategy` parameter. The accepted values are `RETAIN_FIRST` (default), `RETAIN_LAST`, and `RETAIN_UNIQUE`. -[[hystrix]] -=== The Hystrix `GatewayFilter` Factory - -NOTE: https://cloud.spring.io/spring-cloud-netflix/multi/multi__modules_in_maintenance_mode.html[Netflix has put Hystrix in maintenance mode]. We suggest you use the <> with Resilience4J, as support for Hystrix will be removed in a future release. - - -https://github.com/Netflix/Hystrix[Hystrix] is a library from Netflix that implements the https://martinfowler.com/bliki/CircuitBreaker.html[circuit breaker pattern]. -The Hystrix `GatewayFilter` lets you introduce circuit breakers to your gateway routes, protecting your services from cascading failures and letting you provide fallback responses in the event of downstream failures. - -To enable Hystrix `GatewayFilter` instances in your project, add a dependency on `spring-cloud-starter-netflix-hystrix` from https://cloud.spring.io/spring-cloud-netflix/[Spring Cloud Netflix]. - -The Hystrix `GatewayFilter` factory requires a single `name` parameter, which is the name of the `HystrixCommand`. -The following example configures a Hystrix `GatewayFilter`: - -.application.yml -==== -[source,yaml] ----- -spring: - cloud: - gateway: - routes: - - id: hystrix_route - uri: https://example.org - filters: - - Hystrix=myCommandName ----- -==== - -This wraps the remaining filters in a `HystrixCommand` with a command name of `myCommandName`. - -The Hystrix filter can also accept an optional `fallbackUri` parameter. Currently, only `forward:` schemed URIs are supported. If the fallback is called, the request is forwarded to the controller matched by the URI. -The following example configures such a fallback: - -.application.yml -==== -[source,yaml] ----- -spring: - cloud: - gateway: - routes: - - id: hystrix_route - uri: lb://backing-service:8088 - predicates: - - Path=/consumingserviceendpoint - filters: - - name: Hystrix - args: - name: fallbackcmd - fallbackUri: forward:/incaseoffailureusethis - - RewritePath=/consumingserviceendpoint, /backingserviceendpoint ----- -==== - -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 (defined the `lb` prefix on the destination URI). - -The primary scenario is to use the `fallbackUri` to an internal controller or handler within the gateway app. -However, you can also reroute the request to a controller or handler in an external application, as follows: - -.application.yml -==== -[source,yaml] ----- -spring: - cloud: - gateway: - routes: - - id: ingredients - uri: lb://ingredients - predicates: - - Path=//ingredients/** - filters: - - name: Hystrix - args: - name: fetchIngredients - fallbackUri: forward:/fallback - - id: ingredients-fallback - uri: http://localhost:9994 - predicates: - - Path=/fallback ----- -==== - -In this example, there is no `fallback` endpoint or handler in the gateway application. -However, there is one in another application, registered under `http://localhost:9994`. - -In case of the request being forwarded to the fallback, the Hystrix Gateway filter also provides the `Throwable` that has caused it. -It is added to the `ServerWebExchange` as the `ServerWebExchangeUtils.HYSTRIX_EXECUTION_EXCEPTION_ATTR` attribute, which you can use when handling the fallback within the gateway application. - -For the external controller/handler scenario, you can add headers with exception details. -You can find more information on doing so in the <>. - -You can configured Hystrix settings (such as timeouts) with global defaults or on a route-by-route basis by using application properties, as explained on the https://github.com/Netflix/Hystrix/wiki/Configuration[Hystrix wiki]. - -To set a five-second timeout for the example route shown earlier, you could use the following configuration: - -.application.yml -==== -[source,yaml] ----- -hystrix.command.fallbackcmd.execution.isolation.thread.timeoutInMilliseconds: 5000 ----- -==== - [[spring-cloud-circuitbreaker-filter-factory]] === Spring Cloud CircuitBreaker GatewayFilter Factory diff --git a/spring-cloud-gateway-core/src/test/resources/application.yml b/spring-cloud-gateway-core/src/test/resources/application.yml index 4f016bf6..c47e21cf 100644 --- a/spring-cloud-gateway-core/src/test/resources/application.yml +++ b/spring-cloud-gateway-core/src/test/resources/application.yml @@ -135,44 +135,6 @@ spring: predicates: - Host=**.hostmulti1.org,**.hostmulti2.org - # ===================================== - - id: hystrix_failure_test - uri: ${test.uri} - predicates: - - Host=**.hystrixfailure.org - filters: - - Hystrix=failcmd - - # ===================================== - - id: hystrix_fallback_test - uri: ${test.uri} - predicates: - - Host=**.hystrixfallback.org - filters: - - name: Hystrix - args: - name: fallbackcmd - fallbackUri: forward:/fallbackcontroller - - # ===================================== - - id: hystrix_exception_fallback_test - uri: ${test.uri} - predicates: - - Host=**.hystrixexceptionfallback.org - filters: - - name: Hystrix - args: - name: fallbackcmd - fallbackUri: forward:/exceptionFallback - - # ===================================== - - id: hystrix_success_test - uri: ${test.uri} - predicates: - - Host=**.hystrixsuccess.org - filters: - - Hystrix=successcmd - # ===================================== - id: sccb_success_test uri: ${test.uri}