1

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

  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 点。请帮助我如何实现它?

谢谢!

4

1 回答 1

2

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

于 2012-12-05T12:59:42.067 回答