简体   繁体   English

Spring 云网关断路器:默认和特定

[英]Spring Cloud Gateway Circuit Breaker: Default and Specific

I have a Spring Boot application with Spring Cloud Gateway using Resilience4j for circuit breaker:我有一个 Spring 启动应用程序和 Spring 云网关,使用 Resilience4j 作为断路器:

implementation 'org.springframework.cloud:spring-cloud-starter-gateway'
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j'

Currently I have the following routes:目前我有以下路线:

  routes:
    - id: swapi-planets
      uri: https://swapi.devs/api/planets/
      predicates:
        - Path=/api/planets/**
      filters:
        - name: CircuitBreaker
          args:
            fallbackUri: https://swapi.dev/api/species/
    - id: swapi-species
      uri: https://swapi.dev/api/species/
      predicates:
        - Path=/api/species/**
  default-filters:
    - name: CircuitBreaker
      args:
        name: myCircuitBreaker

When I do a call to swapi-pl.nets route I receive the following return from myCircuitBreaker:当我调用 swapi-pl.nets 路由时,我从 myCircuitBreaker 收到以下返回:

{
    "timestamp": "2022-07-21T12:48:59.402+00:00",
    "path": "/api/planets",
    "status": 504,
    "error": "Gateway Timeout",
    "requestId": "8a8cdca2-1"
}

Is there a way to ignore default circuit breaker filter when the route already have a specific circuit breaker?当路由已经有一个特定的断路器时,有没有办法忽略默认的断路器过滤器? In this case swapi-pl.nets has a fallbackUri.在这种情况下,swapi-pl.nets 有一个 fallbackUri。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM