【问题标题】:How can one configure retry for IOExceptions in Spring Cloud Gateway?如何在 Spring Cloud Gateway 中为 IOExceptions 配置重试?
【发布时间】:2018-05-24 23:02:32
【问题描述】:

我看到Retry Filter 支持基于 http 状态码的重试。我想在连接重置等io异常的情况下配置重试。 Spring Cloud Gateway 2 可以做到吗?

【问题讨论】:

    标签: spring-cloud spring-cloud-gateway


    【解决方案1】:

    我使用的是 2.0.0.RC1。看起来最新的构建快照支持基于异常的重试。为下一个版本祈祷。 这是一个针对 500 系列错误或 IOExceptions 重试两次的示例:

    
            filters:
            - name: Retry
              args:
                retries: 2
                series:
                - SERVER_ERROR
                exceptions:
                - java.io.IOException
    

    【讨论】:

    • 你有基于 yml 的重试过滤器配置吗?在任何地方都找不到任何文档,但可以在源代码中看到过滤器
    • @ArpanDas,我已经用一个例子更新了答案。请注意,我在让它工作时遇到了问题,并打开了项目的问题:github.com/spring-cloud/spring-cloud-gateway/issues/339
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-15
    • 2021-01-23
    • 2020-06-21
    • 2020-11-27
    • 2023-03-09
    • 2020-01-28
    相关资源
    最近更新 更多