Git Product home page Git Product logo

googlecloud-pubsub-laravel-queue-driver's Introduction

googlecloud-pubsub-php-adapter

A Google Cloud PubSub driver for Laravel/Lumen Queue.

CI Minimum PHP Version Software License

Installation

You can easily install this package via Composer using this command:

composer require twipi-group/googlecloud-pubsub-laravel-queue-driver

Laravel

Register this package by adding the following line to the autoloaded service providers of your config/app.php file:

TwipiGroup\GoogleCloudPubSubLaravelQueueDriver\GcServiceProviderQueue::class,

Lumen

For Lumen usage, the service provider should be registered manually as follow in your boostrap/app.php file:

$app->configure('queue');
$app->register(TwipiGroup\GoogleCloudPubSubLaravelQueueDriver\GcServiceProviderQueue::class);

Configuration

Add new connection named gcpubsub to your config/queue.php file. You can customize the following options directly from your .env file.

'gcpubsub' => [
    'driver' => 'gcpubsub',
    'project_id' => env('PUBSUB_PROJECT_ID', 'google-cloud-project-id'), // Google cloud project id
    'queue' => env('PUBSUB_QUEUE_DEFAULT', 'default'), // Default queue name corresponding to the gc pubsub topic
    'topic_suffix' => env('PUBSUB_TOPIC_SUFFIX', ''),
    'subscriber_suffix' => env('PUBSUB_SUBSCRIBER_SUFFIX', ''),
    'max_tries' => env('PUBSUB_JOB_MAX_TRIES', 1), // Number of times the job may be attempted.
    'retry_delay' => env('PUBSUB_JOB_RETRY_DELAY', 0), // Delay in seconds before retrying a job that has failed 
],

Running The Queue Worker

You may run the worker using the queue:work Artisan command. (Laravel documentation)

php artisan queue:work gcpubsub [--queue=myqueue]

When APP_DEBUG=true in your .env file, you can check google cloud subscribers from the queue worker output.

Tests

vendor/bin/phpunit tests

Contribution

You can contribute to this package by discovering bugs, opening issues or purpose new features.

Licence

This project is licensed under the terms of the MIT license. See License file for more information.

googlecloud-pubsub-laravel-queue-driver's People

Contributors

missill avatar jarvisho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.