Mar 5th, 2009, 08:43 PM
SpringBatch+Quartz? Or individual Quartz
Please bring your suggestions about my implementation!
What tasks I need to do?
1. Read data from spcefied database;
2. Do some simple business process
3. Write the result into a flat file.
4. The job should be scheduled by some rules, for instance, one time per day or one time per 5 mins.
Since SpringBatch doesn't provide schedules, I must use Quartz. So, I have to use Quartz to start, pause, resume the jobs. Once I use Quartz, it also support jobs well and I found that I could implement the requirement without SpringBatch.
Now, I don't exactly know whether I have to use SpringBatch in my project.
I'm not quite familiar with SpringBatch. But till now, following is my analysis about adopting SpringBatch.
a. SB use Spring framework which makes it more flexible.
b. SB has metadata which is valuable for monitoring the executions of jobs/steps.
c. SB has quite clear lays or components, itemreader, processor, itemwrites. Also, it could control the flow.
a. Seem that SB have lots of dependency libs, that increase the complex of our system.
b. Also there must be some overhead for SB to manager the execution of Jobs. For in our system, performance is quite important. I'm sorry that I don't understand why SB could have high volume throughput.
Really appreciate if you could tell your opinions about my case!!
Mar 6th, 2009, 01:50 AM
I also still new at this but I think this would work:
Setup your job infrastructure via Spring batch and use quartz just for the scheduling of your spring batch job.
For your tasks:
Setup a simple job with 1 step.
As ItemReader use something like JdbcCursorReader to read from db.
For you business logic and processing use an ItemProcessor.
As ItemWriter use the one that fits your file format needs, eg FlatFileItemWriter to write to the flat file.
something like this
<step id="yourStep" >
<tasklet reader="yourJdbcItemReader" processor="yourItemProcessor" writer="yourFileWriter"
Mar 6th, 2009, 02:00 AM
Thanks a lot for your help!
In fact, I have implemented my requirement with Spring Batch & Quartz. It really works. But what I concern is that whether I should adopt Spring Batch in my project. As is known to us, nothing is suitable for all cases. I just try to list the advantage and disadvantage of Spring Batch for my project to determine whether to adopt it in my project.