From 5c02b54010452bedd0b9a2fb0f72d3913a7c0ff3 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Tue, 15 Nov 2016 22:45:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20amqp=20co?= =?UTF-8?q?ntroller,=20=D1=83=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20gii,=20?= =?UTF-8?q?=D0=BE=D1=87=D0=B5=D1=80=D0=B5=D0=B4=D1=8C=20=D1=81=D0=BE=D0=B1?= =?UTF-8?q?=D1=8B=D1=82=D0=B8=D0=B9=20=D0=B0=D0=BA=D0=BA=D0=B0=D1=83=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=20=D1=83=D1=81=D1=82=D0=BE=D0=B9?= =?UTF-8?q?=D1=87=D0=B8=D0=B2=D1=8B=D0=B9=20=D1=80=D0=B5=D0=B6=D0=B8=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/config/config-dev.php | 3 --- composer.json | 3 +-- .../controllers/AccountQueueController.php | 20 +++++-------------- .../controllers/{base => }/AmqpController.php | 2 +- 4 files changed, 7 insertions(+), 21 deletions(-) rename console/controllers/{base => }/AmqpController.php (94%) diff --git a/api/config/config-dev.php b/api/config/config-dev.php index b6f714e..e7bc2d3 100644 --- a/api/config/config-dev.php +++ b/api/config/config-dev.php @@ -12,8 +12,5 @@ return [ 'class' => yii\debug\Module::class, 'allowedIPs' => ['*'], ], - 'gii' => [ - 'class' => yii\gii\Module::class, - ], ], ]; diff --git a/composer.json b/composer.json index df059f8..fb6029c 100644 --- a/composer.json +++ b/composer.json @@ -24,13 +24,12 @@ "php-amqplib/php-amqplib": "^2.6.2", "ely/yii2-tempmail-validator": "~1.0.0", "emarref/jwt": "~1.0.3", - "ely/amqp-controller": "^0.1.2", + "ely/amqp-controller": "dev-master#d7f8cdbc66c45e477c9c7d5d509bc0c1b11fd3ec", "ely/email-renderer": "dev-master#38a148cd5081147acc31125ddc49966b149f65cf" }, "require-dev": { "yiisoft/yii2-codeception": "*", "yiisoft/yii2-debug": "*", - "yiisoft/yii2-gii": "*", "yiisoft/yii2-faker": "*", "flow/jsonpath": "^0.3.1", "codeception/codeception": "~2.2.4", diff --git a/console/controllers/AccountQueueController.php b/console/controllers/AccountQueueController.php index 2036e19..fe3d910 100644 --- a/console/controllers/AccountQueueController.php +++ b/console/controllers/AccountQueueController.php @@ -3,10 +3,9 @@ namespace console\controllers; use common\components\Mojang\Api as MojangApi; use common\components\Mojang\exceptions\NoContentException; -use common\components\RabbitMQ\Component as RabbitMQComponent; use common\models\amqp\UsernameChanged; use common\models\MojangUsername; -use console\controllers\base\AmqpController; +use Ely\Amqp\Builder\Configurator; use GuzzleHttp\Exception\RequestException; class AccountQueueController extends AmqpController { @@ -15,19 +14,10 @@ class AccountQueueController extends AmqpController { return 'events'; } - public function getQueueName() { - return 'accounts-events'; - } - - protected function getExchangeDeclareArgs() { - return array_replace(parent::getExchangeDeclareArgs(), [ - 1 => RabbitMQComponent::TYPE_TOPIC, // type -> topic - 3 => true, // durable -> true - ]); - } - - protected function getQueueBindArgs($exchangeName, $queueName) { - return [$queueName, $exchangeName, 'accounts.#']; + public function configure(Configurator $configurator) { + $configurator->exchange->topic()->durable(); + $configurator->queue->name('accounts-accounts-events')->durable(); + $configurator->bind->routingKey('accounts.username-changed'); } public function getRoutesMap() { diff --git a/console/controllers/base/AmqpController.php b/console/controllers/AmqpController.php similarity index 94% rename from console/controllers/base/AmqpController.php rename to console/controllers/AmqpController.php index 9828298..3a54ed7 100644 --- a/console/controllers/base/AmqpController.php +++ b/console/controllers/AmqpController.php @@ -1,5 +1,5 @@