<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

    主站蜘蛛池模板: 免费看的成人yellow视频| 免费视频精品一区二区三区 | 亚洲熟妇无码爱v在线观看| 久久国产乱子伦精品免费午夜| 日本免费大黄在线观看| 亚洲处破女AV日韩精品| 色www永久免费网站| 天堂在线免费观看中文版| 亚洲AV美女一区二区三区| 久久成人免费大片| 亚洲AV中文无码乱人伦| 亚洲国产中文在线二区三区免| 特级毛片免费播放| 青娱分类视频精品免费2| 亚洲日本久久久午夜精品 | 全亚洲最新黄色特级网站| 亚洲电影一区二区三区| 最近2019中文字幕免费直播| 亚洲国产乱码最新视频| 国产午夜鲁丝片AV无码免费| 亚洲一区二区三区免费观看| 好男人视频在线观看免费看片| 国产亚洲精品美女久久久久 | 国产精品一区二区三区免费| 亚洲成人精品久久| 蜜桃视频在线观看免费网址入口| 99亚洲精品卡2卡三卡4卡2卡| 爱情岛论坛网亚洲品质自拍| 一区二区三区四区免费视频| 91丁香亚洲综合社区| 久久综合给合久久国产免费| 亚洲天堂免费在线| 亚洲第一页综合图片自拍| 无码人妻丰满熟妇区免费 | 美女黄频视频大全免费的| 亚洲国产精品无码专区影院 | 亚洲av无码国产精品色在线看不卡| 香蕉免费一级视频在线观看| 亚洲电影在线免费观看| 四虎永久免费网站免费观看| 97人妻精品全国免费视频|