I am new to spring integration. i have below requirement.
- poll the folder(file system)
- get the XML file
- validate against XSD
- if it is invalid move it to different folder.
- 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!
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.