Mopsy
Mopsy is a PHP library that implements several messaging patterns for RabbitMQ,
based on the Thumper library., (*1)
Unlike Thumper, Mopsy provides support for dead-lettering messages through
retry cycles, and declares an extra exchange and queue for storing dead-letter
messages., (*2)
This library is PSR-0 compatible, and has been tested against RabbitMQ 3.0.1., (*3)
Requirements: PHP 5.3 due to the use of namespaces., (*4)
Setup
Get the library source code:, (*5)
$ git clone git://github.com/ebeyrent/Mopsy.git
Class autoloading and dependencies are managed by composer so install it:, (*6)
$ curl --silent https://getcomposer.org/installer | php
And then install the library dependencies and generate the autoload.php file:, (*7)
$ php composer.phar install
Examples
Examples are in the examples directory., (*8)
'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�., (*9)
Debugging
If you want to know what's going on at a protocol level then add the following
constant to your code:, (*10)
<?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., (*11)
However, this code is not ready for production environments. Use at your own
risk., (*12)
@TODO
- PHPUnit tests!
- More examples
License
See LICENSE.md, (*13)