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

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

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

    paulwong

    Error handling in spring integration - How to get all the errors thrown in multiple threads and send them to the error-channel

    在SPRING INTEGRATION中,如果exception發生在各種thread里時,如何將exception返回到指定的channel,之后再繞回到aggrator-channel中。

    @Bean
    public IntegrationFlow provisionUserFlow() {
    return
        IntegrationFlows.from("input.channel")
        .publishSubscribeChannel(Executors.newCachedThreadPool(),
            s -> s.applySequence(true)
                .subscribe(f -> f.enrichHeaders(e -> e.header(MessageHeaders.ERROR_CHANNEL, "errorChannel", true))
                    .handle(provisionerA, "provision")
                    .channel("aggregatorChannel")
                )
                .subscribe(f -> f.enrichHeaders(e -> e.header(MessageHeaders.ERROR_CHANNEL, "errorChannel", true))
                    .handle(provisionerB, "provision")
                    .channel("aggregatorChannel"))
                )
            .get();
    }

    @Bean
    public IntegrationFlow aggregateFlow() {
        return IntegrationFlows.from("aggregatorChannel")
                        .channel( aggregatorChannel)
                        .aggregate( a -> a.processor( collect, "aggregatingMethod"))
                        .get();
    }

    @Transformer( inputChannel = "errorChannel", outputChannel = "aggregatorChannel")
    public Message<?> errorChannelHandler(ErrorMessage errorMessage) throws RuntimeException {

        Message<?> failedMessage =  ((MessagingException) errorMessage.getPayload()).getFailedMessage();

        Exception exception = (Exception) errorMessage.getPayload();

        return  MessageBuilder.withPayload( exception.getMessage())
                                           .copyHeadersIfAbsent( failedMessage.getHeaders() )
                                           .build();
    }


    https://stackoverflow.com/q/46495127/11790720

    posted on 2020-10-15 19:21 paulwong 閱讀(242) 評論(0)  編輯  收藏 所屬分類: SPRINGSPRING INTERGRATION

    主站蜘蛛池模板: 久久久久久久免费视频| 亚洲偷自拍拍综合网| 一本色道久久88—综合亚洲精品| 国产小视频在线免费| 色视频在线观看免费| 久久久久亚洲精品成人网小说| 曰批全过程免费视频在线观看 | 久久噜噜噜久久亚洲va久| 免费v片在线观看视频网站| 粉色视频成年免费人15次 | 国产精品无码亚洲精品2021| 亚洲一区二区三区偷拍女厕 | 四虎成人免费观看在线网址| 国产精品免费看久久久香蕉| 久久精品亚洲AV久久久无码| 中文字幕亚洲图片| 成人无遮挡裸免费视频在线观看| 91在线免费观看| 色五月五月丁香亚洲综合网| 亚洲精品视频免费看| 精品国产亚洲男女在线线电影| 免费人成在线视频| 久久aⅴ免费观看| www免费黄色网| 亚洲精品女同中文字幕| 4480yy私人影院亚洲| 在线观看亚洲精品福利片| 日本免费网站在线观看| h视频在线观看免费完整版| 国产精品福利片免费看| 狠狠综合亚洲综合亚洲色| 亚洲中文字幕在线无码一区二区| 日本亚洲视频在线| 亚洲无码黄色网址| 国产一区二区三区在线免费| 91在线视频免费看| 国产成人精品免费视频网页大全| 嫩草在线视频www免费观看| 77777午夜亚洲| 亚洲视频网站在线观看| 亚洲AV永久纯肉无码精品动漫|