fun collectJobs()

in dsl/kotless/kotless-lang-local/src/main/kotlin/io/kotless/local/scheduled/ScheduledJob.kt [15:42]


        fun collectJobs(handler: HandlerAWS): Map<Trigger, JobDetail> {
            val jobs = HashMap<Trigger, JobDetail>()

            for ((ids, _, annotation) in EventsReflectionScanner.getEvents()) {
                val id = ids.first()

                val map = JobDataMap().apply {
                    this[ID_KEY] = id
                    this[HANDLER_KEY] = handler
                }
                val job = JobBuilder
                    .newJob(ScheduledJob::class.java)
                    .withIdentity(id)
                    .usingJobData(map)
                    .build()

                val trigger = CronScheduleBuilder
                    .cronSchedule(annotation.cron.toQuartzCron())
                    .build()
                    .triggerBuilder
                    .withIdentity(id)
                    .build()

                jobs[trigger] = job
            }

            return jobs
        }