Skip to content

ScheduleConf Handling Schedule Events

Dennis Vriend edited this page Dec 24, 2017 · 2 revisions

Handling Schedule Events

The AWS serverless framework can be configured to emit events according to a schedule. The ScheduleConf annotation sets a rate at which events will be scheduled to be handled by the lambda.

The syntax is:

rate(value unit)

Where value is a 'a positive number' and unit is 'minute | minutes | hour | hours | day | days'. When value is digit '1', the unit is non-plural, so '1 minute', '1 hour', '1 day'.

Example

The following example shows how to configure the lambda to handle events every single minute:

import com.github.dnvriend.lambda.{ScheduledEvent, SamContext, ScheduledEventHandler}
@ScheduleConf(schedule = "rate(1 minute)")
class PutPersonScheduled extends ScheduledEventHandler {
  override def handle(event: ScheduledEvent, ctx: SamContext): Unit = {
  }
}