ebeyrent/mopsy
最新稳定版本:v0.9.1
Composer 安装命令:
composer require ebeyrent/mopsy
包简介
AMQP Tools
README 文档
README
Mopsy is a PHP library that implements several messaging patterns for RabbitMQ, based on the Thumper library.
Unlike Thumper, Mopsy provides support for dead-lettering messages through retry cycles, and declares an extra exchange and queue for storing dead-letter messages.
This library is PSR-0 compatible, and has been tested against RabbitMQ 3.0.1.
Requirements: PHP 5.3 due to the use of namespaces.
Setup
Get the library source code:
$ git clone git://github.com/ebeyrent/Mopsy.git
Class autoloading and dependencies are managed by composer so install it:
$ curl --silent https://getcomposer.org/installer | php
And then install the library dependencies and generate the autoload.php file:
$ php composer.phar install
Examples
Examples are in the examples directory.
<?php require_once '/path/to/mopsy/vendor/autoload.php'; $producer = new \Mopsy\Producer(new Mopsy\Container(), new Mopsy\Connection\Configuration()); $content = array( 'action' => 'foo', 'options' => array( 'bar' => 'baz', 'debug' => true, ), ); $producer ->setExchangeOptions(Mopsy\Channel\Options::getInstance() ->setName('responsys-exchange') ->setType('direct')) ->publish(new Mopsy\Message($content)); ?>
Queue Server
This example illustrates how to create a producer that will publish jobs into a queue. Those jobs will be processed later by a consumer �or several of them�.
Debugging
If you want to know what's going on at a protocol level then add the following constant to your code:
<?php
define('AMQP_DEBUG', true);
... more code
?>
Disclaimer
This code is experimental. Its purpose is to provide a simple interface for working with RabbitMQ with message failure and dead-letter functionality.
However, this code is not ready for production environments. Use at your own risk.
@TODO
- PHPUnit tests!
- More examples
License
See LICENSE.md
统计信息
- 总下载量: 1.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2013-01-28