lambada-project / lambada

Create replicable serverless environments in seconds
https://lambada-project.github.io
5 stars 1 forks source link

Add support for lambda scheduling #3

Open DaJackkal opened 3 years ago

DaJackkal commented 3 years ago
andreujuanc commented 3 years ago

Even if the underlying implementation of the rules and the scheduling might be too similar. I would keep it separate in terms of the exposed lambada API.

Like this:

run(...., {
     cron: [
           (context)=> {
                 name: "that-batch-job-that-needs-constant-love",
                 rate: "10 minutes",
                 handler: (event) => 1 + 1
           }
     ]
})

Behind the scenes we can do:

   aws.cloudwatch.onSchedule(
        `${cronjobname}-${environment}`,
        `rate(${rate})`,
        handler
    )

Tho, this implementation would be the least malleable.

It is also possible to create it using Pulumi.Aws.CloudWatch.EventRule https://www.pulumi.com/docs/reference/pkg/aws/cloudwatch/eventtarget/

I would need to dig into the aws docs to see how that works.