job_handler

in lib/aws/active_job/sqs/lambda_handler.rb [13:27]


          def job_handler(event:, context:)
            return 'no records to process' unless event['Records']

            puts "job_handler running for #{event} with context: #{context}"

            event['Records'].each do |record|
              sqs_msg = to_sqs_msg(record)
              job = Aws::ActiveJob::SQS::JobRunner.new(sqs_msg)
              puts "Running job: #{job.id}[#{job.class_name}]"
              job.run
              sqs_msg.delete
            end
            "Processed #{event['Records'].length} jobs."
          end