[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
jobs and triggers are not persistent  XML
Forum Index -> Quartz
Author Message
anilhk

journeyman

Joined: 03/14/2012 14:07:42
Messages: 16
Offline

I load the jobs and triggers via the xml file. My jobs and triggers are not persistent. Everytime i stop and start my scheduler all existing triggers disappear. I would like to keep a track of how many jobs/triggers were executed. Can anyone let me know why this is not happening ?

I am using jobStoreTX
anilhk

journeyman

Joined: 03/14/2012 14:07:42
Messages: 16
Offline

Below is my properties file

Code:
 
  #===============================================================
  #Configure ThreadPool
  #===============================================================
  org.quartz.threadPool.threadCount =  5
  org.quartz.threadPool.threadPriority = 5
  org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
  #===============================================================
  #Configure JobStore
  #===============================================================
  #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
  #org.quartz.jobStore.clusterCheckinInterval = 20000
  org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
  org.quartz.jobStore.misfireThreshold = 60000
  org.quartz.jobStore.maxMisfiresToHandleAtATime=20
  org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
  #org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
  org.quartz.jobStore.useProperties = false
  org.quartz.jobStore.dataSource = myDS
  org.quartz.jobStore.tablePrefix = QRTZ_
  org.quartz.jobStore.isClustered = false
  #============================================================================
 
 
  org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
  org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@localhost:1521:eadb
  org.quartz.dataSource.myDS.user = eadb
  org.quartz.dataSource.myDS.password = eadb
  org.quartz.dataSource.myDS.maxConnections = 10
  
  <!-- depricated since 2.0 -->
  #org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
  #============================================================================
  # JobInitializationPlugin (xml declarative way to trigger jobs)
  #============================================================================
  
  org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
  org.quartz.plugin.jobInitializer.fileNames = quartz_data.xml
  org.quartz.plugin.jobInitializer.failOnFileNotFound = true
  org.quartz.plugin.jobInitializer.scanInterval = 120
 
  #============================================================================
  
  
  org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin
  org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}
  org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy}
  org.quartz.plugin.triggHistory.triggerMisfiredMessage = Trigger {1}.{0} misfired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}. Should have fired at: {3, date, HH:mm:ss MM/dd/yyyy}
  org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin 
  org.quartz.plugin.shutdownhook.cleanShutdown = true
 
 
 



Code:
 <?xml version="1.0" encoding="UTF-8"?>
  <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd"
      version="2.0">
      
          
      <processing-directives>
          <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them -->
          <overwrite-existing-data>true</overwrite-existing-data>
          <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error -->
          <ignore-duplicates>false</ignore-duplicates> 
      </processing-directives>
      
    <schedule>
       <job>
  	        <name>TestJob1</name>
  	        <group>GroupOfTestJob1</group>
  	        <job-class>com.macys.dyces.job.SimpleJob</job-class>
  	        <durability>true</durability>
  	        <recover>false</recover>
  	        	        
  		<job-data-map>
  	            <entry>
  	                <key>someKey</key>
  	                <value>someValue</value>
  	            </entry>
  	            <entry>
  	                <key>someOtherKey</key>
  	                <value>someOtherValue</value>
  	            </entry>
  	    </job-data-map>
  	  </job>
  	  
  		<trigger>
  			
  	        <cron>
  	        	<name>TestCronTriggerAtEvery2MinuteInterval</name>
  	        	<group>GroupOfTestJob1Triggers</group>
  	            <job-name>TestJob1</job-name>
  	            <job-group>GroupOfTestJob1</job-group>
                  <cron-expression>0 0/2 * * * ?</cron-expression>
  	        </cron>
  	    </trigger>
      
  	</schedule>    
  </job-scheduling-data>
 
anilhk

journeyman

Joined: 03/14/2012 14:07:42
Messages: 16
Offline

any help would be appreciated..
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1654
Online


No idea. If you're using JDBC JobStore the jobs/triggers will persist through restarts of the scheduler. Many hundreds of thousands of deployments of this out there. Works for everyone else.

So, the problem must be that something in your setup is deleting them upon startup (or shutdown).

I see that you are using the <overwrite-existing-data>true</overwrite-existing-data> directive. This will delete any existing jobs/triggers with the same keys as the ones in your xml file.

anilhk

journeyman

Joined: 03/14/2012 14:07:42
Messages: 16
Offline

Hi JHouse,

If I make this <overwrite-existing-data>true</overwrite-existing-data> as commented then I do see a record inside the qrtz_triggers table but that does not solve my purpose.

Lets say that for a day my cron job executes 2 times daily, I still have one entry in the qrtz_triggers table. I would like to have one entry each in the qrts_trigger table everytime the job executes .. is there a way by which this can be done in quartz ?
anilhk

journeyman

Joined: 03/14/2012 14:07:42
Messages: 16
Offline

Also as per my understanding, everytime a quartz trigger executes it makes an entry in the qrtz_fired_triggers table and when the trigger completes the entry is removed.

Is there a way by which we can persist the entries which are made in the qrtz_fired_triggers table ?

also why always my qrtz_scheduler_state table is always empty ?

any help would be appreciated..

jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1654
Online


Quartz cleans up all of its own unused data so that an administrator doesn't have to delete records filling up the database (many users have millions of triggers firing repeatedly. it is impractical and performance-hindering to keep all that data around).

If you want a history of when triggers have fire, implement a TriggerListener and record the info yourself, much as the LoggingTriggerHistoryPlugin does.

Quartz 2.2 is likely to add a history feature with new api for retrieving the data.

 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team