Announcement Announcement Module
No announcement yet.
processing a collection of items Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • processing a collection of items


    Is there a way to process a group of records as a single item in spring batch?

    Background : we have a simple job which reads a csv file, makes a web service call for each record-id to get additional transaction info and then insert the record into the tables.

    now the WS has been extended to take a list of record-ids and return the transaction information back as a list. we would like to use this feature to decrease the number of WS calls. So our idea is to read 5(configurable value) records from the file, make a WS call for these 5 records and then commit in the database.

    Any pointers on how to achieve this will be of great help.

    thx in adv,

  • #2
    ItemWriter implementations write List of records.
    With each write operation write method writes List<T>. Within the write method you can invoke your WS. After performing your transactions, you write them to tables.
    write method takes commit-interval number of items in the list.

    Hope this helps.