0

I have an online classroom where I need to execute a recorder lambda function at the start time of the class. The time of the execution depends on the time at which user creates a class. How can I run the function at that time? I found no option for this neither in aws lambda or serverless framework. Is there any other service in aws that could help me out?

Yasith Prabuddhaka
  • 859
  • 1
  • 11
  • 17
  • You can use delayed jobs with node js. (Example : https://github.com/Automattic/kue#delayed-jobs) – BTL Jun 03 '19 at 07:53

1 Answers1

0

I used aws step function's wait to execute my lambda at the start of the classroom.

stepFunctions:
  stateMachines:
    stepFunction:
      events:
        - http:
            path: classroom/create
            method: POST
      name: classroom-state-machine
      definition:
        StartAt: RecordingWait
        States:
          RecordingWait:
            Type: Wait
            TimestampPath: "$.start"
            Next: StartRecording
          StartRecording:
            Type: Task
            Resource: arn:aws:lambda:ap-southeast-1:13######:function:consult-api-dev-StartRecorder
            End: True

So when I create a classroom, I start the execution of the state machine passing the class start time as an input to the state machine. The state machine will wait till the start time passed in and then go to the next state which is to execute the recording lambda function.

Yasith Prabuddhaka
  • 859
  • 1
  • 11
  • 17