-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Support Spring @Scheduled annotation as a way of instantiating Recurring tasks #509
Comments
I like the idea! Potentially it'd reduce a big portion of boilerplate. |
Feel free to do so! The help is appreciated! I haven't looked at how the integration works, or if there are any potential pitfalls for db-scheduler, so that is part of the job 😄 |
If it turns out that it is not possible to hook into Spring's |
Thank you for looking into this. I'm curious, is it because that the db-scheduler can't implement "fixed-interval" stuff from this annotation (like fixedRate, fixedDelay)? Initially I was planning to put the feature into spring-boot-module. But since it's not limited by spring anymore, the core package looks like a more suitable place. |
It may be that we need to get a class-instance containing the annotated method from something like the spring context, since it may have dependencies and such. In that case it will have to reside in the spring-boot-module. Not sure exactly how it would look if put in core.. 🤔 |
I was exploring how to implement an annotation to serve as a more or less drop-in replacement for Spring's Scheduled cron jobs.
I also think the polling strategy might pose some challenges. The biggest issue, however, would be that having db-scheduler hook onto the Scheduled annotation would require disabling Spring's annotation-driven scheduling. If we cannot achieve a 100% drop-in replacement, it might be better to create our own annotation. I'm not sure how the annotation could work without Spring. Where would we get the actual class instances to run the methods? I don't think that having annotation without any actual way to use it is sufficient. I have experimented with this, and by using BeanDefinitionRegistryPostProcessor, you can scan for beans with annotated methods and dynamically create recurring tasks, which would be injected with Spring dependencies. |
Support Spring
@Scheduled
annotation as a way of instantiating Recurring tasks. Makes for a convenient and compact way to define recurring tasksThe text was updated successfully, but these errors were encountered: