Feb 25th, 2010, 04:33 PM
Job design in spring batch
Here is my case
My batch application should connect to 3 external databases and read different kinds of data
(Clients, sales transactions etc....) and them update the application database(a 4th dabase)
I have 2 ideas about designing that:
1-I was wonderiong if it`s better to
to create 3 jobs one for each database : so for example the 1 rst step in job1 would be to read client records then save them and the step 2 would be to read transactions and save them
The job2 (for the 2nd external database) would do the same but from databse 2
And the the job 3 (for the 3thrd external database) would do the same from databse 3
As you may guessed if job one fails, we should'nt continue with job2 and 3
2-or to create only one job with 3 steps : each step will extract data from a databse and update my other databse
if it`s better to create 3 jobs , has any one an idea how to start then succesivly from quartz ( the samples shows only one job started from quartz)
and how quartz can make them dependant: I mean, if job 1 fails dont continue with job 2 and 3
Feb 28th, 2010, 01:53 AM
If your job from a logical point of view is consisted of these 3 tasks, I would create a job with 3 steps.
You can control the logic pretty easily (e.g. if a step fails, then do this) and you get a proper lifecycle.
Regarding orchestration, there's no such thing in Spring batch. We have the same requirement and we ended up implementing our own sequencer engine.