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’),
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 to Get Started with Test Driven Development — A Step by Step Guide

Test Driven development, steps to get started with TDD

5 Tips to Surviving your First Week at a Coding Bootcamp

What is Site Reliability Engineering and How Does it Differ from DevOps?

Framework 2: Boss Ai (part 1)

How to add code highlighting in Medium articles without leaving the editor

Would you like to store values? Think of a Variable :)

cs371p 2020: Final Entry

Introducing our Female Software Developers

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

How to install and Secure Redis on Ubuntu 22.04

Create your own hello-world image in Docker

Clear old elements on Redis Cache with Laravel

Give DigitalOcean functions a shot: a new serverless service