Quartz Scheduler NOT STARTED

Viewed 441

I am creating a spring boot application that is using Quartz this is my quartz.yaml file

org:
  quartz:
    dataSource:
      mySql:
        maxIdleTime: '60'
        idleConnectionValidationSeconds: '50'
        password: test2
        user: test2
        URL: jdbc:mysql://localhost:3306/schedules?useSSL=false
        driver: com.mysql.jdbc.Driver
        maxConnections: '10'
        validationQuery: select 0 from dual
    plugin:
      jobHistory:
        class: org.quartz.plugins.history.LoggingJobHistoryPlugin
        jobToBeFiredMessage: 'Job [{1}.{0}] to be fired by trigger [{4}.{3}], re-fire:
          {7}'
        jobFailedMessage: 'Job [{1}.{0}] execution failed with exception: {8}'
        jobWasVetoedMessage: 'Job [{1}.{0}] was vetoed. It was to be fired by trigger
          [{4}.{3}] at: {2, date, dd-MM-yyyy HH:mm:ss.SSS}'
        jobSuccessMessage: 'Job [{1}.{0}] execution complete and reports: {8}'
      triggerHistory:
        class: org.quartz.plugins.history.LoggingTriggerHistoryPlugin
        triggerFiredMessage: 'Trigger [{1}.{0}] fired job [{6}.{5}] scheduled at:
          {2, date, dd-MM-yyyy HH:mm:ss.SSS}, next scheduled at: {3, date, dd-MM-yyyy
          HH:mm:ss.SSS}'
        triggerCompleteMessage: 'Trigger [{1}.{0}] completed firing job [{6}.{5}]
          with resulting trigger instruction code: {9}. Next scheduled at: {3, date,
          dd-MM-yyyy HH:mm:ss.SSS}'
        triggerMisfiredMessage: 'Trigger [{1}.{0}] misfired job [{6}.{5}]. Should
          have fired at: {3, date, dd-MM-yyyy HH:mm:ss.SSS}'
    jobStore:
      maxMisfiresToHandleAtATime: '10'
      dataSource: mySql
      isClustered: 'false'
      class: org.quartz.impl.jdbcjobstore.JobStoreTX
      useProperties: 'true'
      misfireThreshold: '60000'
      driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
      tablePrefix: QRTZ_
    threadPool:
      threadPriority: '5'
      class: org.quartz.simpl.SimpleThreadPool
      threadCount: '4'
    scheduler:
      instanceId: AUTO
      instanceName: SampleJobScheduler
      idleWaitTime: '10000'

I am trying to use SQL database but its uses ram. This is the error I am getting

Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

This is my Configuration

@Configuration
public class Config {

  @Value("${library.file-path.quartz}")
  Resource quartsPath;

  @Autowired private ApplicationContext applicationContext;

  @Bean
  public SchedulerFactoryBean scheduler(JobFactory factory) throws IOException {
    SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
    schedulerFactory.setQuartzProperties(quartzProperties());
    schedulerFactory.setJobFactory(factory);
    return schedulerFactory;
  }

  @Bean
  public SpringBeanJobFactory springBeanJobFactory() {
    AutoWiringSpringBeanJobFactory jobFactory = new AutoWiringSpringBeanJobFactory();
    jobFactory.setApplicationContext(applicationContext);
    return jobFactory;
  }

  public Properties quartzProperties() throws IOException {
    PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
    propertiesFactoryBean.setLocation(quartsPath);
    propertiesFactoryBean.afterPropertiesSet();
    return propertiesFactoryBean.getObject();
  }
}
0 Answers
Related