Announcement Announcement Module
Collapse
No announcement yet.
Itemreader read method while dealing with collections Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Itemreader read method while dealing with collections

    Hi,

    I have created custom item reader by implementing the ItemReader interface.
    From the read method i am calling a business method which will return collection of items.

    public Product read () {

    // calling business method ,returns a list of products.

    }

    According to the commit-interval , how can we return items from reader to writer.

    let say , the list contains 100 products and the commit interval is 10.

    So , i need to return bunch of 10 products to the item writer.

    How we can achieve this?

    Regards,
    Siva

  • #2
    ItemReader<Product> returns a Product (singular) from its read() method. If you can only read them as a collection you can either use ItemReader<Collection<Product>> or you can buffer them inside the reader (and if you do the latter either forget about restartability, or implement ItemStream to count the items and re-position on restart).

    Comment

    Working...
    X