【问题标题】:Spring Integration - Processing Pipeline - DesignSpring 集成 - 处理管道 - 设计
【发布时间】:2017-10-10 15:48:48
【问题描述】:

我正在尝试设计一个需要使用多个端点处理消息的消息处理管道。在每个阶段,端点返回有效负载(可以转换)或错误消息。这是我脑海中的一个通用示例:

<int:payload-type-router input-channel="preprocessing-output">
        <int:mapping type="com.example.Error" channel="error" />
        <int:mapping type="com.example.PreprocessedDomainObject" channel="validation-input"/>
</int:payload-type-router>

<int:service-activator input-channel="validation-input"
        ref="validationService" method="validate" output-channel="validation-output"/>

<int:payload-type-router input-channel="validation-output">
            <int:mapping type="com.example.Error" channel="error" />
            <int:mapping type="com.example.CouldBeAnotherObject" channel="processor-input"/>
</int:payload-type-router>

等等,这个处理链可能很长......有没有更好的方法来设计这个而不是在每个阶段之后设计一个有效负载类型的路由器?感觉有点多余。

【问题讨论】:

    标签: spring-integration


    【解决方案1】:

    好吧,我会根据例外情况来做。验证服务应该只抛出异常,您只需要在调用者上捕获它,或者如果它是入站通道适配器,则使用 errorChannel

    这样你根本不需要那些路由器定义,只需要普通的服务调用链。

    【讨论】:

      猜你喜欢
      • 2013-02-08
      • 1970-01-01
      • 2014-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-13
      • 1970-01-01
      相关资源
      最近更新 更多