I want to do a simple file polling that takes in a CSV file, unmarshals it and loads specific fields into database. I guess that should be a pretty common scenario but I need to use Spring XML instead of creating a java processor. To my surprise I found hard to find any examples on that looking all around the internet. Probably I just didn't look in the right places but for what's worth, I'm sharing my question and my own answer in case someone else finds it useful.
Here's what I'm trying to achieve:
- Automatically pick a CSV file from a folder.
- Load specific fields from CSV into table
CSV looks like this
ID,KEY,FULLNAME,DOCID
1,1,PERSON1,THY
2,1,PERSON2,XCV
3,1,PERSON3,OIU
4,1,PERSON4,KJM
Which needs to be saved into table (only ID and FULLNAME fields):
PERSON
ID | NAME |
---|---|
1 | PERSON1 |
2 | PERSON2 |
3 | PERSON3 |
4 | PERSON4 |
I'm using Camel 3.14.0.