Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using AWS SQS and Lambda for queue job in Laravel

I wonder whether there is a way to use only lambda function when I dispatched a job in laravel.

What I'm using is below.

  • Laravel 5.8(PHP 7.2)
  • AWS SQS
  • Supervisord

In Laravel, I dispatch a job with SQS connection and job is in Laravel project. I searched how I can use SQS as a trigger for lambda function. And I found this document. ( Using AWS Lambda with Amazon SQS ) If I follow this document, I think I can run job in lambda. But In Laravel project, job will be run again. I want to use only lambda as a job.

How I can run only lambda function as a job?

like image 297
errorMessage Avatar asked Dec 22 '25 02:12

errorMessage


1 Answers

No it is not possible. Sqs, database or redis are just for keeping the serialized(encoded etc) version of your laravel jobs. Here is the closest you may get;

  • Forget about sqs queue driver.
  • Implement your job in aws lambda.
  • Allow lambda to consume your sqs (policies, triggers etc listed in the documentation)
  • Make a request from your laravel app via aws php sdk or http request(guzzle, curl) to your sqs and let lambda to consume your sqs.
  • You may use some async driver to trigger your sqs requests asynchronous.
  • If you want to use sqs delay queue, The maximum is 15 minutes - here for the doc
like image 192
Ersoy Avatar answered Dec 25 '25 09:12

Ersoy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!