Package Data | |
---|---|
Maintainer Username: | hnher |
Package Create Date: | 2020-06-18 |
Package Last Update: | 2024-02-28 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-04-26 03:26:03 |
Package Statistics | |
---|---|
Total Downloads: | 61 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
简化基于 Lumen 新项目初始化的时间。
composer create-project hnher/lumen LumenApp
延时任务基于阿里云 RocketMQ 和 pm2 搭建。RocketMQ 作为消息传递、pm2 作为进程守护
namespace App\Modules\Scheduler\Messages;
class TestMessage extends Message
{
public function __construct(string $cmd = 'Scheduler:Test', array $params = [], string $key = '', int $delay = 10)
{
parent::__construct($cmd, $params, $key, $delay);
}
}
可以在代码任何地方使用 Scheduler 门面的 sendMessage 方法发送消息实例
namespace App\Console\Commands;
use App\Facades\Scheduler\Scheduler;
use App\Modules\Scheduler\Messages\TestMessage;
use Illuminate\Console\Command;
class TestCommand extends Command
{
protected $signature = 'Test:Test';
protected $description = '测试使用脚本';
/**
* 业务处理
*/
public function handle()
{
$res = Scheduler::sendMessage(new TestMessage());
dd($res);
}
}
可以在 ecosystem.config.js 文件中指定运行实例和其他配置,也可以继承 ConsumerCommand 自定义消费
pm2 start ecosystem.config.js
Good Luck
If you discover a security vulnerability within Lumen, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Lumen framework is open-sourced software licensed under the MIT license.