marlonfan/nsq_to_swoole
最新稳定版本:1.2.3
Composer 安装命令:
composer require marlonfan/nsq_to_swoole
包简介
a strong php client for NSQ using swoole extension
README 文档
README
a strong php client for NSQ using swoole extension
必要组件
- PHP >= 5.5
- Swoole >= 1.8.6
安装
pecl install swoole
composer require iris/nsq_to_swoole
发布
客户端支持NSQ服务器集群,同时支持单次多条消息发送
$hosts = [ ['host' => '192.168.9.135', 'port' => 4150], ]; $client = new Iris\NsqToSwoole\Client; $client->setTarget($hosts, 1); $client->pub('examples', 'Hello From iris-xie', 1);
订阅
首先通过lookup获取列表,然后才可以订阅
$lookup = new Iris\NsqToSwoole\Lookup\Lookupd([ ['host' => '192.168.9.135', 'port' => 4161], ]); $client = new Iris\NsqToSwoole\Client; $client->sub($lookup, 'examples', 'example', function($moniter, $msg) { echo sprintf("READ\t%s\t%s\n", $msg->getId(), $msg->getPayload()); });
使用示例
cd nsq_to_swoole/examples
Pub:
php Pub.php
Sub:
php Sub.php
统计信息
- 总下载量: 1.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-13