Announcement Announcement Module
Collapse
No announcement yet.
How to Archive Processed files using Spring Batch? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Archive Processed files using Spring Batch?

    I try to archive a processed file in the "After Step" methode, but doesn't work, i think this file is locked by the batch while executing the batch.
    Is there any way to release this file from batch resources so i can move it?

    Thanks.

  • #2
    Moving a file really isn't a good idea in an AfterStep method. Generally, I try to avoid doing anything complex in listener methods. You should have a separate step that takes care of it. The biggest advantage there is that if the move fails, then you can restart directly on that step and just try the move again.

    Comment


    • #3
      Originally posted by DHGarrette View Post
      Moving a file really isn't a good idea in an AfterStep method. Generally, I try to avoid doing anything complex in listener methods. You should have a separate step that takes care of it. The biggest advantage there is that if the move fails, then you can restart directly on that step and just try the move again.
      Good idea, but this new step will need a reader, and I don't want to attach it to same reader as simpleStep, this will also lock my file .

      Comment


      • #4
        You don't need a reader to move a file. You should use a Tasklet to do it. See this for inspiration: http://static.springsource.org/sprin...p.html#d0e3266

        Comment


        • #5
          Originally posted by DHGarrette View Post
          You don't need a reader to move a file. You should use a Tasklet to do it. See this for inspiration: http://static.springsource.org/sprin...p.html#d0e3266
          Thanks, it works nickel.

          Comment

          Working...
          X