https://github.com/limingxinleo/x-swoole-queue
基于Swoole的多进程消息队列
https://github.com/limingxinleo/x-swoole-queue
processes queue swoole
Last synced: 12 months ago
JSON representation
基于Swoole的多进程消息队列
- Host: GitHub
- URL: https://github.com/limingxinleo/x-swoole-queue
- Owner: limingxinleo
- License: mit
- Created: 2018-05-28T04:13:20.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-14T07:13:28.000Z (over 7 years ago)
- Last Synced: 2025-03-19T06:42:48.829Z (12 months ago)
- Topics: processes, queue, swoole
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swoole Queue Library
[](https://travis-ci.org/limingxinleo/x-swoole-queue)
## 安装
~~~
composer require limingxinleo/x-swoole-queue
~~~
## 基本使用办法
消息队列使用
~~~php
setRedisConfig($host, $auth, $db, $port)
->setPidPath(TESTS_PATH . 'queue2.pid')
->run();
~~~
消息类
~~~php
data = $data;
}
public function handle()
{
File::getInstance()->put($this->file, $this->data);
}
}
~~~
载入消费队列的方法
~~~php
lPush('swoole:queue:queue', serialize($job));
~~~
## 高级使用办法
实现我们自己的消息队列类
~~~php
setRedisConfig($host, $auth, $db, $port);
$this->setPidPath(TESTS_PATH . '/queue2.pid');
}
}
~~~
启动我们的消息队列
~~~php
run();
~~~
载入消费数据
~~~php
msg = $msg;
}
public function handle()
{
echo $this->msg;
}
}
$job = new TestJob('upgrade by test job, when the queue push it!');
$queue = new Queue();
$queue->push($job);
~~~