【问题标题】:usage of spring integration's schema validator?spring 集成的模式验证器的使用?
【发布时间】:2012-12-05 12:51:41
【问题描述】:

我是 Spring 集成的新手。我有以下要求。

  1. 轮询文件夹(文件系统)
  2. 获取 XML 文件
  3. 针对 XSD 进行验证
  4. 如果无效,请将其移至其他文件夹。
  5. 如果有效,则调用服务激活器,该激活器会将 xml 文件作为输入发送到 REST ful Web 服务。

我有以下代码:

<int-file:inbound-channel-adapter auto-create-directory="true" channel="contentChannel"  id="inBoundChannelAdapter" directory="${someFolder}" prevent-duplicates="true">
            <int:poller max-messages-per-poll="1" fixed-rate="10000"/>

        </int-file:inbound-channel-adapter>

        <int:channel id="contentChannel"/>

        <int-xml:validating-filter id="schemaValidator" output-channel="someOutPutChannel" throw-exception-on-rejection="false" schema-location="${schema.location}" input-channel="contentChannel" discard-channel=""/>

在这里,我被困在 4 点和 5 点以上。请帮助我如何实现它?

谢谢!

【问题讨论】:

    标签: java spring spring-integration


    【解决方案1】:

    步骤 4+5 正是验证过滤器的丢弃通道和输出通道的用途。只需将出站通道适配器与丢弃通道连接,即可将无效文档写入文件夹。将您的服务激活器连接到输出通道。

    【讨论】:

      猜你喜欢
      • 2014-02-26
      • 1970-01-01
      • 2016-08-28
      • 2022-11-23
      • 2015-10-17
      • 1970-01-01
      • 2018-10-14
      • 2017-02-25
      • 1970-01-01
      相关资源
      最近更新 更多