YiiAMQP

Wrapper for AMQP

Github星跟蹤圖

YiiAMQP

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

##Requirements

Tested with Yii version 1.1.13

##Quick Start

Install via composer, then configure your application to use this component by adding and updating to match your needs the following configuration


'components' => array(
        'rabbitMQ' => array(
            'class' => 'YiiAMQP\AppComponent',
            '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

  • 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

主要指標

概覽
名稱與所有者codemix/YiiAMQP
主編程語言PHP
編程語言PHP (語言數: 1)
平台
許可證
所有者活动
創建於2013-07-19 10:01:52
推送於2013-07-30 14:44:24
最后一次提交2013-06-27 13:35:36
發布數9
最新版本名稱2.0.5 (發布於 )
第一版名稱v2.0.0 (發布於 )
用户参与
星數1
關注者數1
派生數0
提交數59
已啟用問題?
問題數0
打開的問題數0
拉請求數0
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?