ninjaframework / ninja

Ninja is a full stack web framework for Java. Rock solid, fast and super productive.
http://www.ninjaframework.org
Apache License 2.0
1.91k stars 521 forks source link

Add CRON like support on the annotation @Schedule #732

Closed thibaultmeyer closed 2 years ago

thibaultmeyer commented 2 years ago

Information

Description

This PR adds the possibility to use a CRON expression to launch a job at regular intervals without worrying about when the application is started, without any extra dependencies.

The CRON expression can have second, minute, hour, day of month, month and day of week.

// ┌───────────── second (0 - 59)
// │ ┌───────────── minute (0 - 59)
// │ │ ┌───────────── hour (0 - 23)
// │ │ │ ┌───────────── day of the month (1 - 31)
// │ │ │ │ ┌───────────── month (1 - 12)
// │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)
// │ │ │ │ │ │
// * * * * * *

Supported :

raphaelbauer commented 2 years ago

Looks good!

Can you please add the Apache licence headers to the new files? And just to be 100% sure - the code is not copied from another project - correct?

thibaultmeyer commented 2 years ago

Yes, the code was not copied from another project. I add the Apache licence header on new files.

Edit: Done + Rebase to resolve conflict on Changelog.md

@raphaelbauer

raphaelbauer commented 2 years ago

Really nice!