首页 > 解决方案 > 如何在 Spring Integration 中使用路由器从单个类中拆分两个(对象和列表)

问题描述

集成流程:

@Bean
public IntegrationFlow sendFlow() {
    return IntegrationFlows.from("intermediate-channel")
              .log(LoggingHandler.Level.INFO, "RPO-I-0001: Error channel-channel", m
              -> "date: " + ((ErrorHandler) m.getPayload()))
             
            .route(GlobalErrorHandler.class,
            p -> (p.isErrorFlowisNull()),
            m -> m.channelMapping(Boolean.TRUE, "ErrorFlowChannel").channelMapping(Boolean.FALSE,
                    "nullChannel"))
            .get();
}

(部分代码用于将错误列表移动到错误通道) 在 GlobalErrorHandler 类中,我有一个 NormalFlow 类和 errorFlow 列表的对象。现在,我如何使用 .route(GlobalErrorHandler.class) 拆分这两项,并且 normalFlow 应该移动到 normalFlowChannel 和 ,错误流列表应该移动到 errorFlowChannel 条件为 ,如果列表不为空,然后继续 erroFlowChannel否则离开它。

请帮帮我

标签: javaspring-booterror-handlingintegrationrouter

解决方案


推荐阅读