Announcement Announcement Module
Collapse
No announcement yet.
Quartz configuration with both persistent and non-presistent jobs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz configuration with both persistent and non-presistent jobs

    Hey guys,

    I am trying to configure Quartz through Spring so that I can use a single scheduler to execute both persistent and non-persistent jobs. Is this even possible? or would I have to use two different schedulers with 2 different sets of properties?

    The issue is that I'm using a clustered environment in which jobs need to be synchronized across nodes, but each node also needs its own non-persistent jobs to handle node level operations.

    This is what my spring config looks like for the scheduler:


    Code:
    <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		<property name="dataSource" ref="dataSource"/>
    		<property name="transactionManager" ref="txManager"/>
    		<property name="quartzProperties">
    			<bean class="com.hannonhill.cascade.model.quartz.util.QuartzPropertiesFactoryBean">
    				<property name="properties">
    					<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    						<property name="location" value="classpath:com/hannonhill/cascade/config/quartz/quartz.properties"/>
    					</bean>
    				</property>
    				<property name="dataSource" ref="dataSource"/>
    				<property name="customMysqlProperties">
    					<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    						<property name="location" value="classpath:com/hannonhill/cascade/config/quartz/custom.mysql.properties"/>
    					</bean>
    				</property>
    				<property name="customMssqlProperties">
    					<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    						<property name="location" value="classpath:com/hannonhill/cascade/config/quartz/custom.mssql.properties"/>
    					</bean>
    				</property>
    				<property name="customOracleProperties">
    					<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    						<property name="location" value="classpath:com/hannonhill/cascade/config/quartz/custom.oracle.properties"/>
    					</bean>
    				</property>
    			</bean>			
    		</property>
    	</bean>

    So, if I add a "triggers" property to this scheduler, any triggers supplied will become persistent jobs. Is there any way to flag a trigger/job detail as a non-persistent job or something of this sort?

  • #2
    Originally posted by mikessthreat View Post
    I am trying to configure Quartz through Spring so that I can use a single scheduler to execute both persistent and non-persistent jobs. Is this even possible? or would I have to use two different schedulers with 2 different sets of properties?
    What makes you think you can't have both types of job in the same scheduler?

    Originally posted by mikessthreat View Post
    The issue is that I'm using a clustered environment in which jobs need to be synchronized across nodes, but each node also needs its own non-persistent jobs to handle node level operations.
    Have you looked at the clustering capabilities of Quartz?

    Originally posted by mikessthreat View Post
    So, if I add a "triggers" property to this scheduler, any triggers supplied will become persistent jobs. Is there any way to flag a trigger/job detail as a non-persistent job or something of this sort?
    I'm not sure I understand this.
    Last edited by karldmoore; Aug 27th, 2007, 04:46 PM.

    Comment


    • #3
      Originally posted by karldmoore View Post
      Have you looked at the clustering capabilities of Quartz?
      Yes, the scheduler bean in the spring config I supplied above uses a configuration file which sets the scheduler as a clustered instance.

      Originally posted by karldmoore View Post
      What makes you think you can't have both types of job in the same scheduler?
      Well, I have tried adding triggers to the scheduler bean and they are being persisted in the database when I would like for them not to be. For example, I have the following trigger and job detail:

      Code:
      	<bean name="monitor" class="org.springframework.scheduling.quartz.JobDetailBean">
      		<property name="jobClass" value="someJobClass"/>
      	</bean>
      
      	<bean id="monitorTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
      	    <property name="jobDetail" ref="monitor"/>
      	    <property name="startDelay" value="10000" />
      	    <property name="repeatInterval" value="1000" />
      	</bean>
      Then inside the scheduler bean I add a property like the following:

      Code:
          <property name="triggers">
              <list>
                  <ref bean="monitorTrigger" />
              </list>
          </property>
      Since the scheduler bean is configured as a clustered scheduler, it is persisting the "monitor" job when I would like for it not to be.

      Does that make more sense?

      Comment

      Working...
      X