Announcement Announcement Module
Collapse
No announcement yet.
Does Spring batch support multiple writers base on custom condition? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does Spring batch support multiple writers base on custom condition?

    I'm moving from my own in-house batch framework. Actually it works perfectly
    for me and my clients. I'm moving to Grails and Grails is based on Spring framework.
    The problem is I'd like to refactoring all existing libraries to be
    Spring-able and I'm deciding to replace in-house batch framework with
    spring batch. By the way, I'd like to make sure that it supports most of
    the features that my in-house framework has before throwing my
    in-house framework away.

    1. The first feature that I need the most is "Multiple writers base on condition"
    for example if my reader found item error, it should be redirect those items to
    ErrorWriter and add the error message column next to the last field. and for
    all the rest good items, redirect it to SuccessWriter.

    2. Can I do something after batch processing was completed such as generating
    batch id, saving that id to database or deleting/moving the original file.

    3. I see the chunk processing technique and commit interval but if I'd like to commit
    if all items in batch file have no error or rollback all items if at least
    one item in batch file are error.

  • #2
    4. Does spring batch supports "Selecting reader base on custom logic"
    for example
    I'd like the job to select reader base on file extension.
    if the job
    found xml file it will use Xml reader
    found flat file it will use flat file reader
    and so on..

    Comment


    • #3
      No one answer me

      By the way, google and sourcecodes help me a lot.
      And these are the answer that I discovered in last few days
      Question no.1
      Ans.
      ItemProcessListener can do this. but it seems like I can't append error message to the last
      column if I would like to use existing ItemWriter interface. I'll work around for this later.

      Question no.2
      Ans.
      It's not proven yet, but JobExecutionListener should be the correct answer.

      Question no.3
      Ans.
      I've not looked at it yet. skip for now.

      Question no.4
      Ans.
      It is very easy to implemented. I just implements ItemReader interface, set delegated objects,
      and examining resource file. just that!

      Comment

      Working...
      X