xiaohetech/message-queue

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.0.1 2018-08-24 07:27 UTC

This package is not auto-updated.

Last update: 2020-08-08 06:50:04 UTC


README

message-queue是小禾科技的一个composer扩展包,主要功能是提供对队列的操作。

开发状况

  1. 目前只支持RabbitMQ。
  2. 目前只支持单条消息发布和订阅。

如何安装此扩展包

这个扩展包在Packagist上很容易搜索到,然后使用composer工具安装即可

如何使用

加载类库

use xiaohetech\messagequeue\Client as MessageQueneClient;

发布消息

$config = array(
	'host'	=> '', // 主机
	'port'	=> '', // 端口号
	'username'	=> '', // 用户名
	'password'	=> '', // 密码
	'vhost' => '/', // 默认为'/'
);
$queue = 'queue_name'; // 队列名称
$body = array(
	'name' => 'xiaohe.com',
);
$messageQueueClient = new MessageQueneClient($config);
$messageQueueClient->publish($queue, $body);