Using Pub/Sub as a Laravel queue driver

  • Database
  • Redis
  • Beanstalk
  • Amazon SQS

Prepping in the Cloud

Back to Laravel

composer require kainxspirits/laravel-pubsub-queue
‘pubsub’ => [
‘driver’ => ‘pubsub’,
‘queue’ => env(‘PUBSUB_QUEUE’, ‘laravel-queue-1’),
‘project_id’ => env(‘PUBSUB_PROJECT_ID’, ‘insert-project-here’),
‘retries’ => 3,
‘request_timeout’ => 60,
],
‘default’ => env(‘QUEUE_CONNECTION’, ‘pubsub’),
GOOGLE_CLOUD_PROJECT_ID=[GOOGLE_PROJECT_ID]
GOOGLE_APPLICATION_CREDENTIALS=/path_to_credentials.json
export GOOGLE_CLOUD_PROJECT_ID=[GOOGLE_PROJECT_ID]
export GOOGLE_APPLICATION_CREDENTIALS=/path_to_credentials.json

Writing the code

php artisan make:job EchoOutput
Log::info(“Job sent at “.$this->message->format(‘Y-m-d H:i:s’));
EchoOutput::dispatch(new DateTime());

To the cloud and back!

php artisan serve
php artisan queue:work

--

--

--

Senior Cloud Devops Engineer @vbridgebv. Former college teacher.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How will MEAN stack development add value to your business?

Using Streamlit to Create a Calculating App

Cloud-Native Architecture & Design: Data Partition & Replication

Caching with Spring Boot and Aerospike

Qtum Dapp Developer — Run QTUM AMI on AWS EC2 Instance

Infosys Interview Experience — 2021

Blue-Green Deployment

AWS re:Invent 2021 announcement by Adam Selipsky

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alex De Smet

Alex De Smet

Senior Cloud Devops Engineer @vbridgebv. Former college teacher.

More from Medium

Authenticate users with Vue 3, Serverless & AWS Cognito

Configure Laravel with Envoy and Ubuntu 20.04

Deploy a Dockerized Laravel Application to AWS ECS with EC2 Instance Launch type using GitHub…

Deploy Symfony to AWS Elastic Beanstalk