-
Nov 19th, 2012, 05:20 AM
#1
Multi item reader
Hi all,
I am new to spring batch. I'm encoding a batch of spring. I have three input files (client.xml, campaign.txt and famliy.txt) that make up the java object (Message.java) that I should persist. I should read a line from each of the 3files and build the object, the object has properties in 3 files. How I can make a batch that has 3 itemReaders, so read the 3 files and build my object?
Client.xml-> name, id
Campaign.xml -> date, name_campaign
Family.xml -> famliy_name
Java Object: name, id, date, name_campaign, familiy_name
May be somting like this?
<tasklet>
<chunk reader="itemReader" processor="processor" writer="tradeWriter">
<streams>
<stream ref="fileItemReader" />
</streams>
</chunk>
</tasklet>
Any example?
Thank you!
-
Nov 19th, 2012, 01:09 PM
#2
What you're going to end up doing is creating a composite ItemReader implementation that wraps the readers for each of the three resources (client.xml, campaign.xml and family.xml). This ItemReader will be responsible for the assembly of the Message object based on the items each of the other ItemReaders return.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules