Announcement Announcement Module
Collapse
No announcement yet.
Quartz, CronTrigger and parameters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz, CronTrigger and parameters

    Hi all,

    I have just a question about scheduled tasks with quartz, I use CronTrigger, all works well with the cron expression into my xml config file.
    But into my application, time process parameters could be modified and are store into database, so I would like to know if someone have an idea to manage this parameter dynamicaly, asking information about delay store in database, update process scheduler etc etc.

    If someone hav ean idea don't hesitate to help me.

    kind regards.

    I'm sorry i find this thread http://forum.springframework.org/showthread.php?t=29130
    but if you have a good idea about it please help us,

  • #2
    DatabaseStringFactoryBean?

    Hi subich,

    I don't know what you mean about time process parameters. I have also never heard about storing the configuration in the database, so others might have a better way of achieving this.

    Could you create a FactoryBean implementation that returns the value from the database? Here is some sample code:
    Code:
    package org.spring.forum.dbconfig;
    
    import org.springframework.beans.factory.FactoryBean;
    import org.springframework.beans.factory.config.AbstractFactoryBean;
    import org.springframework.dao.DataAccessException;
    
    public class DatabaseStringFactoryBean extends AbstractFactoryBean implements FactoryBean {
    
        private CronExpressionDao cronExpressionDao;
        
        public void setCronExpressionDao(CronExpressionDao cronExpressionDao) {
            this.cronExpressionDao = cronExpressionDao;
        }
    
        @Override
        protected Object createInstance() throws DataAccessException {
            return this.cronExpressionDao.getCronExpression();
        }
    
        public Class getObjectType() {
            return String.class;
        }
    
    }
    Code:
    package org.spring.forum.dbconfig;
    
    public interface CronExpressionDao {
    
        public String getCronExpression();
        
    }
    You would have to manually set the singleton flag to "false" in your application context if you do not want this value looked up only once ("true" is the default for AbstractFactoryBean).

    Good luck!

    -Arthur Loder

    Comment


    • #3
      Hi,

      i have a problem for m y quartz:
      My job run once / day at 5am after the factor job.
      i used crontrigger like this:
      "0 0 5 * * ?" but i dont know how to represente the expression after the factor jab? in the beans or others???
      Can you help me please

      Comment

      Working...
      X