• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

barryvdh/laravel-async-queue: Laravel Async Queue Driver

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

barryvdh/laravel-async-queue

开源软件地址(OpenSource Url):

https://github.com/barryvdh/laravel-async-queue

开源编程语言(OpenSource Language):

PHP 100.0%

开源软件介绍(OpenSource 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




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap