aileftech / snap-admin

A plug-and-play, auto-generated CRUD database admin panel for Spring Boot apps
MIT License
251 stars 18 forks source link

Scheduling and Cron Jobs #28

Open aileftech opened 10 months ago

aileftech commented 10 months ago

The feedback wanted issues are ideas for possible features that I would like to have a feedback on before starting to implement. If you are interested in this features, please leave a reaction or a comment so I understand what features to prioritize.

Scheduling and Cron Jobs

Provide tools for scheduling tasks and running cron jobs (SQL scripts).

a13a commented 10 months ago

I used quartz scheduler for crons, but there is the issue that the application might be clustered, so you have to provide a mechanism to place a DB lock (so that the job is not run by all instances in parallel).

There is not an "official" way to place a DB lock for spring, so different projects will use different implementations.

I think if this feature is not critical, it is better to be omitted, since different projects might want to use snap-admin, but already have an existent mechanism for running cron jobs, that might be different than the one used in snap-admin.

I like the concept of doing one thing very good (exposing a CRUD interface for the entities), so that all kinds of projects can use it without adding additional functionality.

aileftech commented 10 months ago

Hi, and thanks for this feedback!

Yes, I actually agree with this. It's a bit out of scope for this project and has too many "issues" to be implemented reliably. I wouldn't implement this as of now unless it received massive support.

a13a commented 10 months ago

Eventually it could be implemented like an "action" button, that would trigger an external interface, so that the cron would be decoupled from the admin, and if somebody already has an implementation they could use their existing implementation.

maciejwalkowiak commented 10 months ago

If you decide to go implement it, there is a relatively lightweight and most importantly very configurable tool for cluster aware scheduled jobs in spring - https://github.com/lukas-krecan/ShedLock