File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Spring Batch Job seems to be starting one step before last one finishes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Batch Job seems to be starting one step before last one finishes? " Watch "Spring Batch Job seems to be starting one step before last one finishes? " New topic
Author

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

Nadia Roestoff
Greenhorn

Joined: May 10, 2012
Posts: 2
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

Joined: Feb 08, 2009
Posts: 605

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




Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
 
subject: Spring Batch Job seems to be starting one step before last one finishes?