usage of spring integration's schema validator?

南楼画角 提交于 2019-12-08 08:09:48

问题


I am new to spring integration. i have below requirement.

  1. poll the folder(file system)
  2. get the XML file
  3. validate against XSD
  4. if it is invalid move it to different folder.
  5. if it is valid then invoke service activator which will send the xml file as an input to rest ful web service.

I have below code:

<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=""/>

Here i am stuck with above 4 and 5 points. Please help me how can i achieve it?

Thanks!


回答1:


Step 4+5 is exactly what the discard-channel and output-channel of the validating-filter is for. Just connect an outbound-channel-adapter with the discard-channel to have invalid documents written to a folder. Connect your service activator to output-channel.



来源:https://stackoverflow.com/questions/13723687/usage-of-spring-integrations-schema-validator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!