定制 arrounded/queues 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arrounded/queues

最新稳定版本:1.0.2

Composer 安装命令:

composer require arrounded/queues

包简介

A set of queue helpers

关键字:

README 文档

README

An optionated helper for dealing with queues

Build Status Latest Stable Version Total Downloads Scrutinizer Quality Score Code Coverage

Install

Via Composer

$ composer require arrounded/queues

A Laravel 4.2 version also availabe: composer require arrounded/queues:dev-laravel/4.2

Usage

First add the module's service provider and facade to config/app.php:

Arrounded\Queues\ServiceProvider::class
'Queues' => Arrounded\Queues\Facades\Queues::class,

Now you can start using the helper in your application code via the Facade:

Pushing jobs

Queues::on('foo')->uses(Foobar::class)->push()

This will push a job on the local_foo_normal queue.

Priorities

Queues::on('foo')->uses(Foobar::class)->priority(Queues::PRIORITY_HIGH)->push();

This will push a job on the local_foo_high queue.

Passing a payload

Queues::on('foo')->uses(Foobar::class)->with([
	'bar' => 'foo'
])->push();

This will push a job on the local_foo_normal queue with a {'bar': 'foo'} payload

Delaying execution

Queues::on('foo')->uses(Foobar::class)->delay(10)->push();

This will delay the execution of the job by 10 seconds.

Prefixing queue names

The default behavior is to prefix all queues with the current app environment. If you want to overwrite this default on an application level, you can do it in your own ServiceProvider:

$this->app['queues']->setPrefix('foobar') // foobar_foo_normal

Disabling queueing

In some cases you might want to disable queueing all together (for example during integration/functional tests)

// To disable
$this->app['queues']->disabled()

// To re-enable
$this->app['queues']->disabled(false)

Dependency Injection

You can also use dependency injection:

use Arrounded\Queues\Queues;

class FooService
{
	public function __construct(Queues $queues)
	{
		$this->queues = $queues;
	}

Testing

$ composer test

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 290
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-11