Announcement Announcement Module
No announcement yet.
Verify quartz is properly configured with spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Verify quartz is properly configured with spring


    I am in the process of intergrating Quartz with my Spring application. It will required the use of persistent jobs and thus Quartz will be configured to use the data source that the rest of my current Spring application is using.

    Currently, my Spring application is configured with a jdbc data source, Hibernate and transactions. From an application standpoint, this is all working properly. By this I mean that we are a way into the application development where we have established services that communicate with the RDBMS, in this example Oracle, and entities are being created properly.

    The app is divided into roughly 4 bundles:

    1) database bundle - exposed the data source

    2) dao bundle - defines the persistence unit and exposes out all the dao's for the entities

    3) service bundle - the business logic and the transaction layer

    4) web bundle - exposes out the web services and communicates with the service bundle to execute the web service operations.

    Now, through a command line, I ran the oracle script that creates all the tables for Quartz with the same schema that my current application runs in.

    I then modified by service bundle to instantiate a scheduler via the following bean:

    <bean id="schedulerFactoryBean"
    		<property name="dataSource" ref="testDataSource"/>
    		<property name="schedulerName">
    		<property name="transactionManager" ref="testTransactionManager"/>
    The data source and the transaction manager are the same ones used elsewhere in the service bundle and I know those are working properly.

    Now, when i start up my application, it all seems to start up fine, i.e. no exceptions are thrown in any of the trace files.

    But, when examining the QRTZ_SCHEDULER_STATE table, it's empty. I would have expected to see my Testing123 scheduler in there. Am I missing something?

    I purposely haven't taken it any further and tried to schedule jobs or anything since I don't want to get to far and find out I am doing it wrong.

    Anyways, if anybody knows what I may be doing wrong or if my expectation of seeing something in that table is incorrect please let me know.


  • #2
    Well, I went forward with trying to create a job and trigger and that seemed to work properly. Records in other tables got created and updated as necessary. So it seems that it is hooked up properly via the settings above. Although, the QRTZ_SCHEDULER_STATE table still did not get updated with any records so I'm guessing it may only get updated if there are multiple schedulers or maybe if the default scheduler gets paused or something.



    • #3
      Fun of 'The Doctor' ? ur nickname gives it away

      ur quartz scheduler is configured correctly

      if you want to have persistent jobs, your jobs need to imlement StatefulJob

      Below is a link to a thread i started years ago when trying to do same things

      hope it helps



      • #4
        If you just want scheduling, maybe you should toss quartz and use the scheduling support that comes with Spring 3.0.


        • #5
          Agreed, but wait until version 3.0.1 as there @Scheduled is currently registered twice in the current 3 release