-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Spring / SpringBoot integration #55
Comments
Hi! Sure I think that sounds like a good idea provided it does not require too many changes to the core db-scheduler code. I have so far tried to avoid a multi-module project, but this might require it, unless we maintain it in a separate project |
Is this something you would be willing to contribute to? |
Yes, that's my plan but I was thinking about separate module for spring - not something like addons. From my perspective it works quite good. I have similar project and using there that approach: https://github.com/pnowy/NativeCriteria I have some core and spring if someone wants to use direct integration (but I'm also not a big fan of multimodules projects but less than 5 it's ok for me). |
Yeah multi-module is probably the best option. Slighty painful to have to go for a multi-module project structure (increased complexity), but I see no way around it if we want to offer different "flavors" of the lib.. |
So either
or
|
I would prefer first option. The official spring project (https://github.com/spring-projects/spring-framework) has that library part on module name like |
You make a good point :). Not super-happy with the
|
Anyway, that can be tuned later. Would be super-happy for contributions! |
Will probably work on cron and prometheus-metrics for a time myself. |
Personally I would use |
Great idea. Would like to see this happen myself. If there is something I can help with, then I can contribute. |
If someone could post some code-example for this would look that would be helpful :). I am unfortunately not very familiar with Spring Boot.. |
@kagkarlsson I will try to prepare some kind of initial PR but I had very busy March so I hope that on April I will find a time. My plan is to prepare typical autostarter for Spring Boot - similar like other libraries using it (you are adding single dependency and everything works out-of-the-box). |
Ok, great! |
@kagkarlsson I was looking on the Spring Boot integration / tested it and I have some questions / issues to discuss about the vision of that integration. Regarding my plan:
The main area to discuss is about task registration. According to the code and documentation I see currently there is no option to register task dynamically after scheduler configuration (they need to be pointed during schedule on Because I was thinking to prepare the scheduler bean and after that user could inject it somewhere and add additional task configuration (task registrations, etc.). Of course there is an option to provide that configurations by some kind of Supplier/Provider bean which should be prepared before scheduler init by the user but I think user should have an option to register/deregister the tasks with fully initialized scheduler. Is it available - did I miss some part of API? Second option which I consider are some kind of tasks defined as spring beans (except manual registration which could be second option). The Spring users often want to have the option to inject into tasks other beans/components and have context support so we could define some kind of interfaces (and/or abstract classes) where user could implement it (like What do you think about those ideas? @cash1981 if you have any other suggestion it would be great if you could put them here also. @kagkarlsson another question - is there an option of task history? I mean when I register one time task I've noticed that task disappear from scheduler table. Is there a way to keep them after execution but with some executed marker or move them to some kind of history table? Thanks |
Initial thought. If possible I would like to avoid having to support dynamic register/deregister of tasks (just to avoid some complexity). So ideally, all tasks are available when the Scheduler is created. Having them as spring beans makes sense as you say, because the often have dependencies. Also a good idea to have some lightweight annotations where you simply annotate actual execution-handler (for example I have chosen not to support history of executions mostly because I wanted a single database-table that should not get bloated over time. It is possible to create hooks that write the execution to another table on completion, but it would have to go into another module, or at least be an opt-in option |
@evenh -sure - please add my. I will take a look at my free time and will try to help. |
Check your inbox @pnowy :-) |
Received. Thx! |
Part of this issue was implemented by PR #63. We decided not to implement the annotation-variants for now ( |
Released in 6.0. Closing. |
Hi Gustav,
first of all nice work!
Did you consider to prepare separate module (ie. db-scheduler-spring) which provide seamless integration with Spring/Spring Boot?
I was thinking about that a little bit and I think that kind of option could help library gain more popularity. From my perspective what needs to be done to do that:
Are you open to that integration? What do you think about that?
The text was updated successfully, but these errors were encountered: