Skip to content

Commit 2be1df1

Browse files
authored
Merge pull request #282 from php-enqueue/yii-doc
[doc] yii2-queue amqp driver
2 parents fd97546 + cb354cc commit 2be1df1

File tree

3 files changed

+82
-8
lines changed

3 files changed

+82
-8
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,22 @@ Features:
6565
[![Build Status](https://travis-ci.org/php-enqueue/null.png?branch=master)](https://travis-ci.org/php-enqueue/null)
6666
[![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null)
6767
[![Latest Stable Version](https://poser.pugx.org/enqueue/null/version.png)](https://packagist.org/packages/enqueue/null)
68-
* [Symfony bundle](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/quick_tour.md)
69-
* [Magento1 extension](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/magento/quick_tour.md)
70-
* [Laravel extension](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/laravel/quick_tour.md)
71-
* [Message bus](http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageBus.html) support.
72-
* [RPC over MQ](https://www.rabbitmq.com/tutorials/tutorial-one-php.html) support.
68+
* [Symfony bundle](docs/bundle/quick_tour.md)
69+
* [Magento1 extension](docs/magento/quick_tour.md)
70+
* [Laravel extension](docs/laravel/quick_tour.md)
71+
* [Yii2. Amqp driver](docs/yii/amqp_driver.md)
72+
* [Message bus](docs/quick_tour.md#client) support.
73+
* [RPC over MQ](docs/quick_tour.md#remote-procedure-call-rpc) support.
7374
* Temporary queues support.
7475
* Well designed, decoupled and reusable components.
7576
* Carefully tested (unit & functional).
7677
* For more visit [quick tour](docs/quick_tour.md).
7778

7879
## Resources
7980

80-
* [Quick tour](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/quick_tour.md)
81-
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
82-
* [Blog](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md#blogs)
81+
* [Quick tour](docs/quick_tour.md)
82+
* [Documentation](docs/index.md)
83+
* [Blog](docs/index.md#blogs)
8384
* [Questions](https://gitter.im/php-enqueue/Lobby)
8485
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)
8586

docs/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
* [Magento](#magento)
4545
- [Quick tour](magento/quick_tour.md)
4646
- [Cli commands](magento/cli_commands.md)
47+
* [Yii](#yii)
48+
- [AMQP Interop driver](yii/amqp_driver.md)
4749
* [Use cases](#use-cases)
4850
- [FOSElasticaBundle. Populate command optimizations](elastica-bundle/populate-command-optimization.md)
4951
- [Symfony. Async event dispatcher](async_event_dispatcher/quick_tour.md)

docs/yii/amqp_driver.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Yii2Queue. AMQP Interop driver
2+
3+
_**Note: ** This a copy of [AMQP Interop doc](https://github.com/yiisoft/yii2-queue/blob/master/docs/guide/driver-amqp-interop.md) from the yiisoft/yii2-queue [repository](https://github.com/yiisoft/yii2-queue)._
4+
5+
6+
The driver works with RabbitMQ queues.
7+
8+
In order for it to work you should add any [amqp interop](https://github.com/queue-interop/queue-interop#amqp-interop) compatible transport to your project, for example `enqueue/amqp-lib` package.
9+
10+
Advantages:
11+
12+
* It would work with any amqp interop compatible transports, such as
13+
14+
* [enqueue/amqp-ext](https://github.com/php-enqueue/amqp-ext) based on [PHP amqp extension](https://github.com/pdezwart/php-amqp)
15+
* [enqueue/amqp-lib](https://github.com/php-enqueue/amqp-lib) based on [php-amqplib/php-amqplib](https://github.com/php-amqplib/php-amqplib)
16+
* [enqueue/amqp-bunny](https://github.com/php-enqueue/amqp-bunny) based on [bunny](https://github.com/jakubkulhan/bunny)
17+
18+
* Supports priorities
19+
* Supports delays
20+
* Supports ttr
21+
* Supports attempts
22+
* Contains new options like: vhost, connection_timeout, qos_prefetch_count and so on.
23+
* Supports Secure (SSL) AMQP connections.
24+
* An ability to set DSN like: amqp:, amqps: or amqp://user:pass@localhost:1000/vhost
25+
26+
Configuration example:
27+
28+
```php
29+
return [
30+
'bootstrap' => [
31+
'queue', // The component registers own console commands
32+
],
33+
'components' => [
34+
'queue' => [
35+
'class' => \yii\queue\amqp_interop\Queue::class,
36+
'port' => 5672,
37+
'user' => 'guest',
38+
'password' => 'guest',
39+
'queueName' => 'queue',
40+
'driver' => yii\queue\amqp_interop\Queue::ENQUEUE_AMQP_LIB,
41+
42+
// or
43+
'dsn' => 'amqp://guest:guest@localhost:5672/%2F',
44+
45+
// or, same as above
46+
'dsn' => 'amqp:',
47+
],
48+
],
49+
];
50+
```
51+
52+
Console
53+
-------
54+
55+
Console is used to listen and process queued tasks.
56+
57+
```sh
58+
yii queue/listen
59+
```
60+
61+
`listen` command launches a daemon which infinitely queries the queue. If there are new tasks
62+
they're immediately obtained and executed. This method is most efficient when command is properly
63+
daemonized via supervisor.
64+
65+
`listen` command has options:
66+
67+
- `--verbose`, `-v`: print executing statuses into console.
68+
- `--isolate`: verbose mode of a job execute. If enabled, execute result of each job will be printed.
69+
- `--color`: highlighting for verbose mode.
70+
71+
[back to index](../index.md)

0 commit comments

Comments
 (0)