I am trying to make use of the EventScheduler in the Axon Framework. I require persistence on the scheduled tasks as they get scheduled via events in the system and losing them when the JVM shuts down or restarts is not an option.
This led me to the QuartzEventScheduler. I dug around trying to find documentation on how to configure it in Spring Boot 2.2.2 but cannot find anything. Then I tried to find documentation on how to configure the Quartz scheduler in Spring Boot hoping it would allow me use the configuration in the QuartzEventScheduler.
The problem I am having is that the documentation and examples on the QuartzScheduler all reference a Job implementation. What Job implementation should I be referencing when trying to configure the Axon Framework QuartzEventScheduler?
Any documentation on how to do this would be greatly appreciated.
Thanks in advance.
Seems it was as simple as adding:
@Configuration
public class SchedulerConfig {
@Bean
public QuartzEventSchedulerFactoryBean quartzEventSchedulerFactoryBean() {
return new QuartzEventSchedulerFactoryBean();
}
}
to the code base and:
spring:
quartz:
job-store-type: jdbc
jdbc:
initialize-schema: always // comment this out after creation otherwise all existing tasks get removed
to the application.yml
If you are using Postgres as the storage engine and Spring Boot add:
spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
to the application.properties file
Posting this here for anyone else struggling like I did.