I have created a Spring Boot application wherein main class I am creating a scheduler object.
prop.put("quartz.scheduler.instanceName", "ServerScheduler");
prop.put("org.quartz.scheduler.instanceId", "AUTO");
prop.put("org.quartz.scheduler.skipUpdateCheck", "true");
prop.put("org.quartz.scheduler.instanceId", "CLUSTERED");
prop.put("org.quartz.scheduler.jobFactory.class", "org.quartz.simpl.SimpleJobFactory");
prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.StdJDBCDelegate");
prop.put("org.quartz.jobStore.dataSource", "quartzDataSource");
prop.put("org.quartz.jobStore.tablePrefix", "H1585.QRTZ_");
prop.put("org.quartz.jobStore.isClustered", "false");
prop.put("org.quartz.scheduler.misfirePolicy", "doNothing");
prop.put("org.quartz.dataSource.quartzDataSource.driver", "com.ibm.db2.jcc.DB2Driver");
prop.put("org.quartz.dataSource.quartzDataSource.URL", url);
prop.put("org.quartz.dataSource.quartzDataSource.user", user);
prop.put("org.quartz.dataSource.quartzDataSource.password", passwrd);
prop.put("org.quartz.dataSource.quartzDataSource.maxConnections", "2");
SpringApplication.run(SchedulerApplication.class, args);
try {
SchedulerFactory stdSchedulerFactory = new StdSchedulerFactory(prop);
Scheduler scheduler = stdSchedulerFactory.getScheduler();
scheduler.start();
I want to use the same scheduler object in my service class to trigger the job. The one which I am getting using below code is not working showing different instance id.
scheduler = StdSchedulerFactory.getDefaultScheduler();
How can I solve this?