<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    paulwong

    SPRING INTEGRATION RETRY

    當(dāng)使用httpOutBoundGateway時,有時會碰到網(wǎng)絡(luò)抖動問題而出現(xiàn)連接異常,這時應(yīng)該有個重試機(jī)制,如隔多少秒重試,重試多少次后放棄等。
    默認(rèn)是重試3次,每次重試間隔是20秒。

    @SpringBootApplication
    public class SpringIntegrationDslHttpRetryApplication {

        @SuppressWarnings("unchecked")
        public static void main(String[] args) {
            ConfigurableApplicationContext applicationContext =
                    SpringApplication.run(SpringIntegrationDslHttpRetryApplication.class, args);
            Function<Object, Object> function = applicationContext.getBean(Function.class);
            function.apply("foo");
        }

        @Bean
        public IntegrationFlow httpRetryFlow() {
            return IntegrationFlows.from(Function.class)
                    .handle(Http.outboundGateway("http://localhost:11111")
                                    .httpMethod(HttpMethod.GET)
                                    .expectedResponseType(String.class),
                            e -> e.advice(retryAdvice()))
                    .get();
        }

        @Bean
        public RequestHandlerRetryAdvice retryAdvice() {
            return new RequestHandlerRetryAdvice();
        }

    }

    #打印日志
    logging.level.org.springframework.retry=debug

    Reference:
    https://docs.spring.io/spring-integration/reference/html/handler-advice.html#retry-advice
    https://stackoverflow.com/questions/49784360/configure-error-handling-and-retry-for-http-outboundgateway-spring-dsl
    https://stackoverflow.com/questions/50262862/requesthandlerretryadvice-with-httprequestexecutingmessagehandler-not-working
    https://stackoverflow.com/questions/63689856/spring-integration-http-outbound-gateway-retry-based-on-reply-content
    https://blog.csdn.net/cunfen8879/article/details/112552420


    posted on 2021-08-23 13:01 paulwong 閱讀(250) 評論(0)  編輯  收藏 所屬分類: SPRING INTERGRATION

    主站蜘蛛池模板: 亚洲中文字幕AV每天更新| 亚洲一区无码中文字幕| 好吊妞在线成人免费| 在线观看免费人成视频| 丁香花免费高清视频完整版| 中文字幕av无码无卡免费| 黄色成人网站免费无码av| 我想看一级毛片免费的| 免费无码黄动漫在线观看| 国产美女精品久久久久久久免费 | 亚洲AV成人影视在线观看| 亚洲精品第一综合99久久| 中文无码亚洲精品字幕| 亚洲av无码专区在线电影天堂 | 亚洲动漫精品无码av天堂| 亚洲AV成人无码久久精品老人| 亚洲国产精品久久久久婷婷老年| 亚洲自偷自偷精品| 亚洲一区免费视频| 国产午夜亚洲精品不卡免下载| 成年网站免费入口在线观看| 中文字幕免费在线看线人动作大片| 国产一级片免费看| 日本三级2019在线观看免费| 日韩免费无砖专区2020狼| 亚洲精品成人久久久| 国产国拍亚洲精品mv在线观看| 18gay台湾男同亚洲男同| 在线a亚洲老鸭窝天堂av高清| 国产精品亚洲精品爽爽| 国产在线观看免费av站| 亚洲成年人免费网站| 日韩免费高清视频| 亚洲色偷偷综合亚洲AVYP| 亚洲最大的视频网站| 亚洲av纯肉无码精品动漫| GOGOGO免费观看国语| 又黄又爽又成人免费视频| 又爽又高潮的BB视频免费看| 日本亚洲视频在线| 国产亚洲福利在线视频|