Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
layout parent title nav_order
AMQP Interop driver

{% include %}

Yii2Queue. AMQP Interop driver

Note: This a copy of AMQP Interop doc from the yiisoft/yii2-queue repository.

The driver works with RabbitMQ queues.

In order for it to work you should add any amqp interop compatible transport to your project, for example enqueue/amqp-lib package.


Configuration example:

return [
    'bootstrap' => [
        'queue', // The component registers own console commands
    'components' => [
        'queue' => [
            'class' => \yii\queue\amqp_interop\Queue::class,
            'port' => 5672,
            'user' => 'guest',
            'password' => 'guest',
            'queueName' => 'queue',
            'driver' => yii\queue\amqp_interop\Queue::ENQUEUE_AMQP_LIB,

            // or
            'dsn' => 'amqp://guest:guest@localhost:5672/%2F',

            // or, same as above
            'dsn' => 'amqp:',


Console is used to listen and process queued tasks.

yii queue/listen

listen command launches a daemon which infinitely queries the queue. If there are new tasks they're immediately obtained and executed. This method is most efficient when command is properly daemonized via supervisor.

listen command has options:

  • --verbose, -v: print executing statuses into console.
  • --isolate: verbose mode of a job execute. If enabled, execute result of each job will be printed.
  • --color: highlighting for verbose mode.

back to index