Giter VIP home page Giter VIP logo

laravel-async-queue's Introduction

Laravel 5 Async Queue Driver

Push a function/closure to the background.

For Laravel 5.4, check the 0.6 branch

For Laravel 5.3, check the 0.5 branch

Just like the 'sync' driver, this is not a real queue driver. It is always fired immediatly. The only difference is that the closure is sent to the background without waiting for the response. This package is more usable as an alternative for running incidental tasks in the background, without setting up a 'real' queue driver.

Note: This is using the DatabaseQueue, so make sure you set that up first, including migrations.

Install

Require the latest version of this package with Composer

composer require barryvdh/laravel-async-queue

Add the Service Provider to the providers array in config/app.php

Barryvdh\Queue\AsyncServiceProvider::class,

You need to create the migration table for queues and run it.

$ php artisan queue:table
$ php artisan migrate

You should now be able to use the async driver in config/queue.php. Use the same config as for the database, but use async as driver.

'connections' => array(
    ...
    'async' => array(
        'driver' => 'async',
        'table' => 'jobs',
        'queue' => 'default',
        'expire' => 60,
    ),
    ...
}

Set the default to async, either by changing to config or setting QUEUE_DRIVER in your .env file to async.

Note: By default, php is used as the binary path to PHP. You can change this by adding the binary option to the queue config. You can also add extra arguments (for HHVM for example)

'connections' => array(
    ...
    'async' => array(
        'driver' => 'async',
        'table' => 'jobs',
        'queue' => 'default',
        'expire' => 60,
        'binary' => 'php',
        'binary_args' => '',
    ),
    ...
}

It should work the same as the sync driver, so no need to run a queue listener. Downside is that you cannot actually queue or plan things. Queue::later() is also fired directly. For more info see http://laravel.com/docs/queues

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.