Results 1 to 3 of 3

Thread: SpringBatch+Quartz? Or individual Quartz

  1. #1

    Question SpringBatch+Quartz? Or individual Quartz

    All,
    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.
    Advantage:
    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.
    Disadvantage:
    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!!

  2. #2
    Join Date
    Mar 2009
    Posts
    130

    Default

    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

    <job id="yourJob">
    <step id="yourStep" >
    <tasklet reader="yourJdbcItemReader" processor="yourItemProcessor" writer="yourFileWriter"
    commit-interval="${job.commit.interval}" />
    </step>

    </job>

  3. #3

    Default

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

Posting Permissions

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