2017 © Pedro Peláez
 

yii2-extension yii2-rabbitmq

Yii2 rabbitmq

image

cperdana/yii2-rabbitmq

Yii2 rabbitmq

  • Sunday, May 20, 2018
  • by cperdana
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

yii2-rabbitmq

Yii2 Rabbimmq, (*1)

Installation

add, (*2)

"cperdana/yii2-rabbitmq": "*"

to the require section of your composer.json file., (*3)

Used PhpAmqpLib

add component in config file, (*4)

'rabbit' => [
    'class' => 'cperdana\rabbitmq\RabbitPhpAmqpLib',
    'host' => '127.0.0.1',
    'port' => 5666,
    'user' => 'user_login',
    'pass' => 'user_pass',
    'vhost' => '/',
    'readQueueName' => 'read_queue',

    'sendExchangeName' => 'exchange_name',
    'sendExchangeType' => 'fanout', // fanout/direct
    'sendQueueName' => 'send_queue'
],

add console command, (*5)

use PhpAmqpLib\Message\AMQPMessage;
use cperdana\rabbitmq\RabbitPhpAmqpLib;

class MsgqueController extends \yii\console\Controller
{
    private function execute($message){
        echo $message->body;

        $rabbit = \Yii::$app->rabbit;
        $rabbit->sendAck($message);    
    }

    public function actionSend($themsg){
        $rabbit = \Yii::$app->rabbit;
        $rabbit->send($themsg);
    }

    public function actionRead(){

        $callback = function($message){
            $this->execute($message);            
        };

        $rabbit = \Yii::$app->rabbit;
        $rabbit->read($callback);
    }
}

as consumer, (*6)

php yii msgque/read

as publisher, (*7)

php yii msgque/send "this is the message to sent to rabbitmq"

The Versions

20/05 2018

dev-master

9999999-dev

Yii2 rabbitmq

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar cperdana

rabbitmq yii2 phpamqlib phpamqp

20/05 2018

v1.0.2

1.0.2.0

Yii2 rabbitmq

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar cperdana

rabbitmq yii2 phpamqlib phpamqp

20/05 2018

v1.0.1

1.0.1.0

Yii2 rabbitmq

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar cperdana

rabbitmq yii2 phpamqlib phpamqp

19/05 2018

v1.0

1.0.0.0

Yii2 rabbitmq

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar cperdana

rabbitmq yii2 phpamqlib phpamqp