-
Notifications
You must be signed in to change notification settings - Fork 58
Kotless Events API
Vladislav.Tankov edited this page Jun 13, 2020
·
2 revisions
Kotless DSL provides number of annotations to work with different Events sources in the cloud.
Scheduled
annotation declares that function annotated with it
should be triggered by a timer.
Mostly, it should be used to set up scheduled jobs.
Note that the function should not have any parameters, since it will be called via crontab-like service that passes no context.
The annotation requires cron
argument — it is a cron expression
that defines trigger behavior. Its syntax is taken from AWS Scheduled
Events (more detailed information).
Also, you can provide id
argument — it will be used to create
a trigger on a cloud side. In case no id
is provided, it will be
generated by Kotless during deployment.
Here is an example of Scheduled job:
@Scheduled(Scheduled.everyHour)
fun storageCleanup() {
logger.info("Starting storage cleanup")
Storage.cleanup()
logger.info("Ended storage cleanup")
}