2017 © Pedro Peláez
 

yii2-extension yii2-amqp

AMQP protocol extension for Yii2

image

starcode-krasnodar/yii2-amqp

AMQP protocol extension for Yii2

  • Monday, August 29, 2016
  • by starcode-solutions
  • Repository
  • 4 Watchers
  • 3 Stars
  • 348 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 4 Open issues
  • 12 Versions
  • 2 % Grown

The README.md

yii2-amqp

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Extension Yii2 for working with AMQP protocol, (*2)

installation

Via composer, (*3)

composer require "starcode/yii2-amqp:2.*"

or add composer.json, (*4)

{
    "require": {
        "starcode/yii2-amqp": "2.*"
    }
}

configuration

Create amqp component config, (*5)

[
    'components' => [
        'amqp' => [
            'class' => 'starcode\amqp\components\Connection',
            'host' => 'localhost',
            'user' => 'guest',
            'password' => 'guest',
            'connectionOptions' => [
                'vhost' => '/',
            ],

            'queuesConfig' => [
                'email' => [
                    'queue' => 'email',
                    'durable' => true,
                    'auto_delete' => false,
                ],
                'logs' => [
                    'queue' => 'logs',
                    'durable' => true,
                    'auto_delete' => false,
                ],
            ],
        ],
    ],
];

usage

Publish message., (*6)

// get queue object
$queue = Yii::$app->get('amqp')->getQueue('email');

// create message object
$message = new Message('my message', ['delivery_mode' => 2]);

// publish message
$queue->publish($message);

Listen messages, (*7)

// get queue object
$queue = Yii::$app->get('amqp')->getQueue('email');

// callback listener function
$callback = function($message) {
    echo $message->body;

    // acknowledge message
    $channel = $msg->delivery_info['channel'];
    $channel->basic_ack($msg->delivery_info['delivery_tag']);
};

$queue->consume([
    'callback' => $callback,
]);

$channel = $queue->getChannel();
while (count($channel->callbacks)) {
    $channel->wait();
}

The Versions

29/08 2016

dev-master

9999999-dev

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

29/08 2016

2.1.0

2.1.0.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

01/12 2015

2.0.3

2.0.3.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

01/12 2015

2.0.2

2.0.2.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

01/12 2015

2.0.1

2.0.1.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

01/12 2015

2.0.0

2.0.0.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

12/08 2015

1.1.1

1.1.1.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

12/08 2015

1.1.0

1.1.0.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

11/08 2015

1.0.3

1.0.3.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

11/08 2015

1.0.2

1.0.2.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

11/08 2015

1.0.1

1.0.1.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter

27/07 2015

1.0.0

1.0.0.0

AMQP protocol extension for Yii2

  Sources   Download

The Requires

 

by Memory Clutter