@@ -6,6 +6,17 @@ RabbitMQ Queue driver for Laravel
66[ ![ StyleCI] ( https://styleci.io/repos/14976752/shield )] ( https://styleci.io/repos/14976752 )
77[ ![ License] ( https://poser.pugx.org/vladimir-yuldashev/laravel-queue-rabbitmq/license?format=flat-square )] ( https://packagist.org/packages/vladimir-yuldashev/laravel-queue-rabbitmq )
88
9+ ## Support Policy
10+
11+ | Package Version | Laravel Version | Bug Fixes Until |
12+ | -----------------| -----------------| ---------------------|
13+ | 6.0 | 5.5 | August 30th, 2019 |
14+ | 7.0 | 5.6 | August 7th, 2018 |
15+ | 7.1 | 5.7 | March 4th, 2019 |
16+ | 7.2 | 5.8 | August 26th, 2019 |
17+ | 9 | 6 | September 3rd, 2021 |
18+ | 10 | 6 | September 3rd, 2021 |
19+
920## Installation
1021
1122You can install this package via composer using this command:
@@ -21,106 +32,40 @@ Setup connection in `config/queue.php`
2132``` php
2233'connections' => [
2334 // ...
35+
2436 'rabbitmq' => [
2537
26- 'driver' => 'rabbitmq',
27-
28- /*
29- * Set to "horizon" if you wish to use Laravel Horizon.
30- */
31- 'worker' => env('RABBITMQ_WORKER', 'default'),
32-
33- 'dsn' => env('RABBITMQ_DSN', null),
34-
35- /*
36- * Could be one a class that implements \Interop\Amqp\AmqpConnectionFactory for example:
37- * - \EnqueueAmqpExt\AmqpConnectionFactory if you install enqueue/amqp-ext
38- * - \EnqueueAmqpLib\AmqpConnectionFactory if you install enqueue/amqp-lib
39- * - \EnqueueAmqpBunny\AmqpConnectionFactory if you install enqueue/amqp-bunny
40- */
41-
42- 'factory_class' => Enqueue\AmqpLib\AmqpConnectionFactory::class,
43-
44- 'host' => env('RABBITMQ_HOST', '127.0.0.1'),
45- 'port' => env('RABBITMQ_PORT', 5672),
46-
47- 'vhost' => env('RABBITMQ_VHOST', '/'),
48- 'login' => env('RABBITMQ_LOGIN', 'guest'),
49- 'password' => env('RABBITMQ_PASSWORD', 'guest'),
50-
51- 'queue' => env('RABBITMQ_QUEUE', 'default'),
52-
53- 'options' => [
54-
55- 'exchange' => [
56-
57- 'name' => env('RABBITMQ_EXCHANGE_NAME'),
58-
59- /*
60- * Determine if exchange should be created if it does not exist.
61- */
62-
63- 'declare' => env('RABBITMQ_EXCHANGE_DECLARE', true),
64-
65- /*
66- * Read more about possible values at https://www.rabbitmq.com/tutorials/amqp-concepts.html
67- */
68-
69- 'type' => env('RABBITMQ_EXCHANGE_TYPE', \Interop\Amqp\AmqpTopic::TYPE_DIRECT),
70- 'passive' => env('RABBITMQ_EXCHANGE_PASSIVE', false),
71- 'durable' => env('RABBITMQ_EXCHANGE_DURABLE', true),
72- 'auto_delete' => env('RABBITMQ_EXCHANGE_AUTODELETE', false),
73- 'arguments' => env('RABBITMQ_EXCHANGE_ARGUMENTS'),
74- ],
75-
76- 'queue' => [
77-
78- /*
79- * Determine if queue should be created if it does not exist.
80- */
81-
82- 'declare' => env('RABBITMQ_QUEUE_DECLARE', true),
83-
84- /*
85- * Determine if queue should be binded to the exchange created.
86- */
87-
88- 'bind' => env('RABBITMQ_QUEUE_DECLARE_BIND', true),
89-
90- /*
91- * Read more about possible values at https://www.rabbitmq.com/tutorials/amqp-concepts.html
92- */
93-
94- 'passive' => env('RABBITMQ_QUEUE_PASSIVE', false),
95- 'durable' => env('RABBITMQ_QUEUE_DURABLE', true),
96- 'exclusive' => env('RABBITMQ_QUEUE_EXCLUSIVE', false),
97- 'auto_delete' => env('RABBITMQ_QUEUE_AUTODELETE', false),
98- 'arguments' => env('RABBITMQ_QUEUE_ARGUMENTS'),
99- ],
100- ],
101-
102- /*
103- * Determine the number of seconds to sleep if there's an error communicating with rabbitmq
104- * If set to false, it'll throw an exception rather than doing the sleep for X seconds.
105- */
106-
107- 'sleep_on_error' => env('RABBITMQ_ERROR_SLEEP', 5),
108-
109- /*
110- * Optional SSL params if an SSL connection is used
111- * Using an SSL connection will also require to configure your RabbitMQ to enable SSL. More details can be founds here: https://www.rabbitmq.com/ssl.html
112- */
113-
114- 'ssl_params' => [
115- 'ssl_on' => env('RABBITMQ_SSL', false),
116- 'cafile' => env('RABBITMQ_SSL_CAFILE', null),
117- 'local_cert' => env('RABBITMQ_SSL_LOCALCERT', null),
118- 'local_key' => env('RABBITMQ_SSL_LOCALKEY', null),
119- 'verify_peer' => env('RABBITMQ_SSL_VERIFY_PEER', true),
120- 'passphrase' => env('RABBITMQ_SSL_PASSPHRASE', null),
121- ],
38+ 'driver' => 'rabbitmq',
39+ 'queue' => env('RABBITMQ_QUEUE', 'default'),
40+ 'connection' => PhpAmqpLib\Connection\AMQPLazyConnection::class,
41+
42+ 'hosts' => [
43+ [
44+ 'host' => env('RABBITMQ_HOST', '127.0.0.1'),
45+ 'port' => env('RABBITMQ_PORT', 5672),
46+ 'user' => env('RABBITMQ_USER', 'guest'),
47+ 'password' => env('RABBITMQ_PASSWORD', 'guest'),
48+ 'vhost' => env('RABBITMQ_VHOST', '/'),
49+ ],
50+ ],
51+
52+ 'options' => [
53+ 'ssl_options' => [
54+ 'cafile' => env('RABBITMQ_SSL_CAFILE', null),
55+ 'local_cert' => env('RABBITMQ_SSL_LOCALCERT', null),
56+ 'local_key' => env('RABBITMQ_SSL_LOCALKEY', null),
57+ 'verify_peer' => env('RABBITMQ_SSL_VERIFY_PEER', true),
58+ 'passphrase' => env('RABBITMQ_SSL_PASSPHRASE', null),
59+ ],
60+ ],
61+
62+ /*
63+ * Set to "horizon" if you wish to use Laravel Horizon.
64+ */
65+ 'worker' => env('RABBITMQ_WORKER', 'default'),
12266
12367 ],
68+
12469 // ...
12570],
12671```
@@ -141,37 +86,12 @@ For Lumen usage the service provider should be registered manually as follow in
14186$app->register(VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class);
14287```
14388
144-
145- ## Using other AMQP transports
146-
147- The package uses [ enqueue/amqp-lib] ( https://github.com/php-enqueue/enqueue-dev/blob/master/docs/transport/amqp_lib.md ) transport which is based on [ php-amqplib] ( https://github.com/php-amqplib/php-amqplib ) .
148- There is possibility to use any [ amqp interop] ( https://github.com/queue-interop/queue-interop#amqp-interop ) compatible transport, for example ` enqueue/amqp-ext ` or ` enqueue/amqp-bunny ` .
149- Here's an example on how one can change the transport to ` enqueue/amqp-bunny ` .
150-
151- First, install desired transport package:
152-
153- ``` bash
154- composer require enqueue/amqp-bunny:^0.8
155- ```
156-
157- Change the factory class in ` config/queue.php ` :
158-
159- ``` php
160- // ...
161- 'connections' => [
162- 'rabbitmq' => [
163- 'driver' => 'rabbitmq',
164- 'factory_class' => Enqueue\AmqpBunny\AmqpConnectionFactory::class,
165- ],
166- ],
167- ```
168-
16989## Testing
17090
17191Setup RabbitMQ using ` docker-compose ` :
17292
17393``` bash
174- docker-compose up -d
94+ docker-compose up -d rabbitmq
17595```
17696
17797To run the test suite you can use the following commands:
0 commit comments