ghostwalker / jobber
强大的、简单的消息队列客户端
dev-master
2022-08-30 13:12 UTC
Requires
- nette/robot-loader: ^3.4
- react/async: ^4.0
- react/promise: ~2.0
- react/socket: ^1.12
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^6.1
This package is auto-updated.
Last update: 2024-09-29 06:14:53 UTC
README
欢迎使用 Jobber 👋
强大的、简单的消息队列客户端
安装
composer require ghostwalker/jobber
用法
在主目录中创建 bootServer.php 文件。您也可以指定服务器和客户端的地址和端口,以及指定存储您的类的目录。
<?php /** * boot JobberServer Class */ use GhostWalker\Jobber\JobberServer; require_once __DIR__ . 'vendor/autoload.php'; JobberServer::$directory = __DIR__ . '/jobs'; JobberServer::$ipPort = '127.0.0.1:6969'; JobberServer::bootSystem();
启动服务器
php bootServer.php //To keep the process running permanently in the background,
you should use a process monitor such as Supervisor to ensure that the queue worker does not stop running.
在您指定的目录中创建一个类并创建一个 "__construct" 方法
该方法接受一个 $date 数组的参数
<?php class test { protected array $data = []; public function __construct(array $data) { $this->data = $data //array(int(999)) } }
创建一个客户端类并加载一个新任务
<?php use \GhostWalker\Jobber\JobberClient; require __DIR__ . '/vendor/autoload.php'; JobberClient::$ipPort = '127.0.0.1:6969'; $jobber = new JobberClient(); $jobber->addTask(test::class, [999]); $jobber->addTask(test1::class, [123]);
作者
👤 GhostWalker
- Github: @GhostWalkers
🤝 贡献
欢迎贡献、问题和功能请求!
请随意查看 问题页面。
工作
应用程序基于 ReactPhp,以及用于加载类的 robot-loader。
展示您的支持
如果此项目对您有帮助,请给它一个 ⭐️!
📝 许可证
版权 © 2022 GhostWalker。
此项目遵循 MIT 许可。
❤️ readme