Simplifying db-scheduler Integration in a Microservice Architecture via a wrapper around db-scheduler #743
beilCrxmarkets
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🧩 Initial Situation
We operate a microservice architecture with 20+ Spring Boot services, primarily written in Java. For scheduling financing-related jobs reliably and persistently, we chose to integrate the db-scheduler library.
During a POC with one of our services, we realized that while db-scheduler is powerful, it offers more flexibility than we actually need. Features like
OneTimeTask,CustomTask, and generic support added complexity to our use case.Additionally, we had to implement:
Copy-pasting these configurations across multiple services was not sustainable.
✅ Solution
We built a wrapper library around db-scheduler to abstract away the complexity and centralize configuration. This gave us several benefits:
🔧 Our API Design
We only support two types of tasks: static recurring tasks and dynamic recurring tasks with persistent scheduling.
Static Recurring Tasks
Developers implement this interface and expose it as a Spring Bean.
Dynamic Recurring Tasks
These are scheduled and managed via:
We scan for beans implementing these interfaces, build the corresponding
RecurringTaskorRecurringTaskWithPersistentSchedule, and pass them to theSchedulerBuilder.💬 Discussion Points
We also considered building a utility library that only provides the
TestExecutionListenerand a preconfiguredFailureHandler. However, this would still require developers to learn the db-scheduler API and would tightly couple our services to it.Looking forward to hearing how others approached this!
Beta Was this translation helpful? Give feedback.
All reactions