maxbrokman/safe-queue
Composer 安装命令:
composer require maxbrokman/safe-queue
包简介
A Laravel Doctrine friendly daemonising queue worker for Laravel 5
README 文档
README
A Laravel Queue worker that's safe for use with Laravel Doctrine
When to use SafeQueue
- You use Laravel 5
- You use Laravel Doctrine
- Devops say the CPU usage of
queue:listenis unacceptable - You want to do
php artisan queue:work --daemonwithout hitting cascadingEntityManager is closedexceptions
Compatibility
| Version | Supported Laravel Versions |
|---|---|
| 0.1.* | 5.1, 5.2 |
| 0.2.* | ^5.3.16 |
| 0.3.* | ^5.4.9 |
How it Works
SafeQueue overrides a small piece of Laravel functionality to make the queue worker daemon safe for use with Doctrine. It makes sure that the worker exits if the EntityManager is closed after an exception. For good measure it also clears the EM before working each job.
Installation
Install using composer
composer require maxbrokman/safe-queue
Once you've got the codez add the following to your service providers in app.php
MaxBrokman\SafeQueue\DoctrineQueueProvider::class
Lumen
Create the config file config/safequeue.php and load it: $app->configure('safequeue');
<?php
return [
/*
|--------------------------------------------------------------------------
| Worker Command Name
|--------------------------------------------------------------------------
|
| Configure the signature / name of the Work Command here. The default
| is to rename the command to 'doctrine:queue:work', however you can
| rename it to whatever you want by changing this value.
|
| To override the Laravel 'queue:work' command name just set this
| to a false value or 'queue:work'.
|
*/
'command_name' => 'doctrine:queue:work',
];
Usage
php artisan doctrine:queue:work connection --daemon -sleep=3 --tries=3 ...
All options are identical to Laravel's own queue:work method.
Contributing
PRs welcome. Please send PRs to the relevant branch (0.1, 0.2, 0.3) depending on which version of Laravel you are targeting.
Run tests and style fixer.
vendor/bin/php-cs-fixer fix
vendor/bin/phpunit
Maintenance
I maintain this as part of my day job, please open any issues on Github
maxbrokman/safe-queue 适用场景与选型建议
maxbrokman/safe-queue 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 151.56k 次下载、GitHub Stars 达 31, 最近一次更新时间为 2016 年 07 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 maxbrokman/safe-queue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 maxbrokman/safe-queue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 151.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-14