I am a newbie to the Spring Integration framework, so I have questions regarding my current workflow that I need to implement. Not sure how to do proper modeling for that. Here are the steps that need to be done:
- Polling filesystem directory for newly arrived XML files (using inbound-channel-adapter). Structure of file is similar to next one:
<user>
<name>Steve</name>
<email>[email protected]</email>
<dateOfBirth>01.01.1990</dateOfBirth>
<documents>
<document>
<fileName>test.pdf</fileName>
</document>
<document>
<fileName>test.mp3</fileName>
</document>
<document>
<fileName>image.png</fileName>
</document>
<document>
<fileName>test2.pdf</fileName>
</document>
</documents>
</user>
- When XML file is polled, do checking of the
documentselement whether those (pdf, mp3, images...) exist in the polling directory. If not throw an error and change the extension of the XML file. - If everything ok collects and send each of those documents to the third-party system (custom, independent java library) for optimization.
- If optimization was done well, we need to read XML and from data within it create an Object that will be sent to another system for inserting using API with those optimized files.
- If that insert goes well, we need to change the XML file by inserting new elements base on the value of the element. Depending on the value XML file will be modified and moved to new folders with all optimized documents contained in that file.
Is this a good use case for Spring Integration? I am not sure how to model this workflow correctly. Can you please give me some tips?
Thanks in advance