Announcement Announcement Module
No announcement yet.
Which is the best solution for my purpose? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Which is the best solution for my purpose?


    I am new to Spring an in this forum and I does not know how to start or which is the best solution for my purpose.
    - I want to configure jobs in a database.
    - These jobs should run periodically (cron) and/or manually.
    - A job can be made of one ore more steps.
    - A job can log information which could be presented to the user.
    - There must be a kind of group which purpose it is to guarantee that at a single time only one job of a group runs.

    Now I am confused about what I have to do.
    I have made some examples with CronTrigger, JobRepository, JobLauncher, Tasklets, Steps, ... but I don't know how to mix them together to get the best/right solution for my purpose.

    I am hoping for good answers.


  • #2
    If you are looking for some sort of scheduler which could pick your jobs and execute it according to certain parameters, using any open source scheduler integrated with standard spring project can be used. One such open source schedulers is Quartz.

    I think you have used right methodlogies in Spring to execute the jobs, only thing is that scheduling is not available built-in in spring as there are already open source projects doing this in a better way.
    Last edited by tomcyjohn; Mar 28th, 2012, 07:29 AM.


    • #3
      Thanks for the quick reply.

      I have forgot to say that I am already using Quartz.
      But I dont know how to mix them all up together.

      My current theoretical solution was:
      - Store job information in database (in my own tables)
      - Configure a simple job which runs every 5 minutes, looks in the database and checks if there are job configurations deleted or changed and trigger or stop/delete jobs.

      But I have problems by putting all these together.

      Have I to make a SimpleJob and add the steps or have I to make Tasklets?
      I would be very helpful if someone could get me a quick overview which object (Job, Tasklet, JobRepsitory, ...) is made for which purpose.


      • #4
        Why would you want to store job information when Spring is already doing it for you ?
        I would suggest not to mix triggering mechanism and your job. Trigger can be from anywhere , be it a quarz scheduler, common j , cron or even a web page. It is just a trigger to start your job. With that in my I have just implemented a batch solution with a mix of Spring Integration and Spring Batch. The triggering mechanism is actually a command message in a particular Q in MQ . The producer of the message can be a manual run from a UI which creates a message in the Q and also a java timer which puts the same message in the q.
        On the batch side the job name and job params are unmarsahlled form the xml message and my transformer transforms them into the spring batch dependant JobParameters...and the job laucher launches the job with those params.


        • #5

          where does Spring store job information for me?
          I thought Spring stores only runtime information of the jobs in a job repository but no generell information about what a job consists of or how its name is.


          • #6
            Have you looked into the configuration files? By default it stores all the job information like job names, job instances as well as parameters you passed including if the job FAILED or not in a in- memory database. You can always make it persistent by pointing it to a persistent data store.