Skip to content

Error while using driver 'amqp_interop' with RabbitMQ  #465

Closed
@dkduyanh

Description

Error while using driver 'amqp_interop' with RabbitMQ

What steps will reproduce the problem?

I need to connect my app to RabbitMQ.
I saw that the amqp driver was deprecated mentioned here (https://github.com/yiisoft/yii2-queue/blob/master/docs/guide/driver-amqp.md)
So, I followed the document to setup the connection with 'amqp_interop' driver (https://github.com/yiisoft/yii2-queue/blob/master/docs/guide/driver-amqp-interop.md).

My configuration was:

return [
'class' => \yii\queue\amqp_interop\Queue::class,
'host' => 'localhost',
'port' => '5672',
'user' => 'guest',
'password' => 'guest',
'queueName' => 'queue',
'driver' => \yii\queue\amqp_interop\Queue::ENQUEUE_AMQP_LIB,
];

What's expected?

The RabbitMQ connection established.

What do you get instead?

Exception 'Error' with message 'Class "Interop\Amqp\AmqpQueue" not found'

in /app/share/samples/vendor/yiisoft/yii2-queue/src/drivers/amqp_interop/Queue.php:192

Stack trace:
#0 /app/share/samples/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs()
#1 /app/share/samples/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#2 /app/share/samples/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#3 /app/share/samples/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject()
#4 /app/share/samples/vendor/yiisoft/yii2/base/Module.php(766): yii\di\ServiceLocator->get()
#5 /app/share/samples/vendor/yiisoft/yii2/base/Application.php(311): yii\base\Module->get()
#6 /app/share/samples/vendor/yiisoft/yii2/base/Application.php(271): yii\base\Application->bootstrap()
#7 /app/share/samples/vendor/yiisoft/yii2/console/Application.php(124): yii\base\Application->init()
#8 /app/share/samples/vendor/yiisoft/yii2/base/BaseObject.php(109): yii\console\Application->init()
#9 /app/share/samples/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct()
#10 /app/share/samples/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct()
#11 /app/share/samples/yii(18): yii\console\Application->__construct()
#12 {main}

Additional info

Q A
Yii version 2.0.47
PHP version 8.2
Operating system LinuxMint 21.1

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions