Announcement Announcement Module
Collapse
No announcement yet.
Multi item reader Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #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.

    Comment

    Working...
    X