Results 1 to 5 of 5

Thread: How to Archive Processed files using Spring Batch?

  1. #1
    Join Date
    Jul 2009
    Posts
    3

    Default 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. #2
    Join Date
    Feb 2008
    Posts
    488

    Default

    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.

  3. #3
    Join Date
    Jul 2009
    Posts
    3

    Default

    Quote 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 .

  4. #4
    Join Date
    Feb 2008
    Posts
    488

    Default

    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

  5. #5
    Join Date
    Jul 2009
    Posts
    3

    Thumbs up

    Quote 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •