yiiamqp YiiAMQP is a fully functional AMQP producer and conusumer Yii application component.

YiiAMQP ¶

  1. Requirements
  2. Dependencies
  3. Quick Start
  4. Usage
  5. Contributing
  6. Bug tracker
  7. Credits
  8. License

YiiAMQP is a fully functional AMQP producer and conusumer Yii application component.

Requirements ¶

Tested with Yii version 1.1.13

Dependencies ¶

This component has a number of critical dependencies in order to function properly. Given the broad range on possible applications of this component these dependencies have not been included.

Please ensure you install and configure these dependencies prior to the installation of YiiAMQP.

Quick Start ¶

Clone the repo, git clone git://github.com/mteichtahl/YiiAMQP.git, or download the latest release.

Configure your application to use this component by adding and updating to match your needs the following configuration

components' => array(
        'rabbitMQ' => array(
            'class' => 'application.components.RabbitMQ.RabbitMQ',
            'server' => array(
                'host' => 'localhost',
                'port' => '5672',
                'vhost' => '/',
                'user' => 'guest',
                'password' => 'guest'
            )
        ),

Usage ¶

Producer ¶
Yii::app()->rabbitMQ->createConnection();
Yii::app()->rabbitMQ->declareQueue('mail');
Yii::app()->rabbitMQ->declareExchange('exchange.mailService', 'topic');
Yii::app()->rabbitMQ->bind('mail', 'exchange.mailService', 'mail');
Yii::app()->rabbitMQ->setQoS('0', '1', '0');
Yii::app()->rabbitMQ->sendJSONMessage('"test":"test"','mail');
Yii::app()->rabbitMQ->sendTextMessage('text message"','mail');
Consumer ¶

Initialise the component

Yii::app()->rabbitMQ->declareExchange('exchange.mailService', 'topic');
Yii::app()->rabbitMQ->bind($queue, 'exchange.mailService', 'mail');
Yii::app()->rabbitMQ->setQoS('0', '1', '0');
Yii::app()->rabbitMQ->registerCallback(array($this, 'myCallback'));
Yii::app()->rabbitMQ->consume($queue, $this->id);
Yii::app()->rabbitMQ->wait();

Create the callback function

public static function myCallback($msg) { }

Contributing ¶

Please submit all pull requests against *-wip branches. Thanks!

Bug tracker ¶

If you find any bugs, please create an issue at https://github.com/mteichtahl/YiiAMQP/issues

Credits ¶

  • gaAutoLoader [https://gist.github.com/mindplay-dk/4234540] Rasmus Schultz
  • CPSLiveLogRoute [http://www.pogostick.com] Jerry Ablan jablan@pogostick.com
  • php-amqplib [https://github.com/videlalvaro/php-amqplib] Vadim Zaliva lord@crocodile.org
  • rabbitMQ [http://www.rabbitmq.com/] VMWare

License ¶

License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License

5 1
12 followers
0 downloads
Yii Version: 1.1
License: LGPL-3.0
Category: Networking
Developed by: mteichtahl mteichtahl
Created on: Feb 9, 2013
Last updated: 12 years ago

Related Extensions