Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Batch Job seems to be starting one step before last one finishes?

 
Nadia Roestoff
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to Spring Batch and hope someone can help me.

I have a simple job with three steps. The first steps does something with a file using a tasklet and then writes it back with a different name/extenstion. Step 2 is a chunk related reader/writer step that picks up this file, reads it with a multiresourceitemreader (so that I could use wildcards) and writes it to a database. Step 3 renames this file.

At first my job was implemented with step 2 only - works great. I then added the rename step - works fine. Then lastly I added step one...this is where the trouble starts. Step 1 on its own works...I can see the file being written back with the different extention. But step 2 now gives me a warning that there is no resources to be read. If then I comment out my tasklet code for step 1 (so the changed filename is still in the folder) and run the job again...then it does pick it up. So it almost seems as if Step 2 tries to find the file before it is written? Is this possible? Am I understanding batch correctly that one step has to complete before the next one start (in the way I wired it up?) Any ideas of what I can try to solve this?

Some code samples below.

Thanks




 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't step three actually rename the file to *_TEST.txt. So why do you expect step "2" to find such files?
Spring should execute the steps in order of the "next" specified on the step ...



 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic