Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Dynamic Job Scheduling using Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic Job Scheduling using Spring

    Hi,

    In my application some jobs are scheduled using spring on top of Quartz. So, we are giving the scheduled time in the configuration file itself. So, whenever there is a need to change the schedule time, we are manually changing that xml file and redeploying the application once again and restarting the server. FYI, the application is running on tomcat web server.

    But now we want to make it dynamically where we can cange the schedule timings.

    ========================
    <bean id="readIVAVfromCLSJobInvokerCronTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail" ref="readIVAVfromCLSJobInvoker" />
    <!-- run every month, any day of the month, from monday till saturday, 17:15 -->
    <property name="cronExpression" value="0 30 12-18 ? * MON-SAT" />
    </bean>
    ==========================

    Can anyone suggest me the possible solutions for this.

  • #2
    Did you ever get this figured out? If so, please post your solution.

    Comment


    • #3
      Please post your solution, if this was resolved.

      Comment


      • #4
        Can you not use a propertyPlaceHolder to externalise the timings and then use JMX to refresh the application context?

        Comment


        • #5
          I am not sure how i do it.

          Actually my requirement is like this:

          In a DB Table i will have the name of the class and the method that need to be executed at regular intervals. Any needed params will be stored in an XML or DB.

          Now i have a Scheduler that is triggered every 15 minutes.
          This scheduler should have the ability to schedule the events that are in the DB as quartz cron jobs.

          I have done this but through a different approach. Now all my classes extend Spring's JobDetailBean.

          But what i want to do is eliminate this extends, and then have the ability to execute any method inside the class instead of executeInternal or execute?

          Could you please suggest a way to do this?
          Thanks in Advance

          Comment


          • #6
            Did you figured it out? I am looking for exactly same thing. Please suggest me your solution to this?

            Regards
            Harshi

            Comment


            • #7
              Dynamic Scheduling

              I found this solution in some other place, I dont exactly remember where.

              The idea here is simple.

              First create a Manager job that runs every 15 odd minutes (depending on how quick the turnaround is needed.) The job of this Manager is to look into any updates in the DB in the last 15 (or the given turn around time) minutes and enforce the changes.

              The Manager creates individual schedulers per entry in the table and tracks them.

              Then any updates to these schedulers are tracked and enforced by the Manager.

              Pradeep

              Comment


              • #8
                Thanks Pradeep.

                That means we end up running multiple schedulers ,one per Job Manager and each scheduler based on database settings?

                Basically one scheduler starts all other schedulers? Is it okay run multiple schedulers rather than multiple jobs with single scheduler?

                Would it be better to run one scheduler and add triggers and jobs at run time in the code rather than in spring configuration?

                Here is my requirement.

                In the database we store which class need to be executed at what time for each customer.

                I need to load all the configurations from the database and schedule based on it.

                After it stopped it needs to look in the database again to see any thing is changed and based on that new scheduling should happen?
                Last edited by harshi; Apr 13th, 2009, 10:49 PM.

                Comment


                • #9
                  Dynamic Scheduling

                  Hi Harshi,

                  Depending on the load on the server we can go for one or multiple schedulers. The quartz schedulers are light weight as such.

                  For your requirement you can go for one manager scheduler and a executing scheduler with multiple triggers for each customer. The Manager Scheduler can then check the db for regular updates and propagate the same to the individual triggers.

                  Pradeep

                  Comment


                  • #10
                    I solved the same issue

                    I had the same requirements: I needed to dynamically create/update the scheduling of quartz jobs within a spring web application, recovering the triggering/job options from a DB instead of a config file.

                    I finally managed to make it work: I basically kept a reference to the Quartz Scheduler (by injection) and use it to access to the triggers/jobs when needed.

                    Take a look at this post on another thread for details:
                    http://forum.springsource.org/showth...ghlight=quartz

                    It works great for me. Hope it helps.

                    Geez.

                    Comment

                    Working...
                    X