Results 1 to 3 of 3

Thread: Quartz configuration with both persistent and non-presistent jobs

  1. #1

    Default 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. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Quote 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?

    Quote 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?

    Quote 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 at 03:46 PM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #3

    Default

    Quote 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.

    Quote 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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •