Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit 610b233

Browse files
committed
updated readme, fixes
1 parent 9799d9c commit 610b233

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

README.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,46 @@ After composer update is finished you need to add ServiceProvider to your `provi
1111

1212
'FintechFab\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider',
1313

14-
now you are able to configure your connections in queue.php:
15-
16-
return [
17-
18-
'default' => 'rabbitmq',
19-
20-
'connections' => [
21-
22-
'rabbitmq' => [
23-
'driver' => 'rabbitmq',
24-
25-
'host' => '',
26-
'port' => 5672,
27-
28-
'vhost' => '/',
29-
'login' => '',
30-
'password' => '',
31-
32-
'queue' => '', // name of the default queue,
33-
34-
'queue_params' => [
35-
'passive' => false,
36-
'durable' => true,
37-
'exclusive' => false,
38-
'auto_delete' => false,
39-
],
40-
41-
'exchange_params' => [
42-
'type' => 'direct', // more info at http://www.rabbitmq.com/tutorials/amqp-concepts.html
43-
'passive' => false,
44-
'durable' => true, // the exchange will survive server restarts
45-
'auto_delete' => false, // the exchange won't be deleted once the channel is closed.
46-
],
47-
48-
],
49-
14+
Add these lines to your `app/config/queue.php` file to `connections` array:
15+
16+
'rabbitmq' => [
17+
'driver' => 'rabbitmq',
18+
19+
'host' => env('RABBITMQ_HOST', '127.0.0.1'),
20+
'port' => env('RABBITMQ_PORT', 5672),
21+
22+
'vhost' => env('RABBITMQ_VHOST', '/'),
23+
'login' => env('RABBITMQ_LOGIN', 'guest'),
24+
'password' => env('RABBITMQ_PASSWORD', 'guest'),
25+
26+
'queue' => env('RABBITMQ_QUEUE'), // name of the default queue,
27+
28+
'queue_params' => [
29+
'passive' => env('RABBITMQ_QUEUE_PASSIVE', false),
30+
'durable' => env('RABBITMQ_QUEUE_DURABLE', true),
31+
'exclusive' => env('RABBITMQ_QUEUE_EXCLUSIVE', false),
32+
'auto_delete' => env('RABBITMQ_QUEUE_AUTODELETE', false),
5033
],
51-
52-
];
5334

54-
You can also find these examples in src/examples folder.
35+
'exchange_params' => [
36+
'type' => env('RABBITMQ_EXCHANGE_TYPE', 'direct'), // more info at http://www.rabbitmq.com/tutorials/amqp-concepts.html
37+
'passive' => env('RABBITMQ_EXCHANGE_PASSIVE', false),
38+
'durable' => env('RABBITMQ_EXCHANGE_DURABLE', true), // the exchange will survive server restarts
39+
'auto_delete' => env('RABBITMQ_EXCHANGE_AUTODELETE', false),
40+
],
41+
42+
],
43+
44+
And add these properties to `.env` with proper values:
45+
46+
RABBITMQ_HOST=127.0.0.1
47+
RABBITMQ_PORT=5672
48+
RABBITMQ_VHOST=/
49+
RABBITMQ_LOGIN=guest
50+
RABBITMQ_PASSWORD=guest
51+
RABBITMQ_QUEUE=invoices
52+
53+
You can also find full examples in src/examples folder.
5554

5655
####Usage
5756
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to change anything else. If you do not know how to use Queue API, please refer to the official Laravel documentation: http://laravel.com/docs/queues

src/FintechFab/LaravelQueueRabbitMQ/LaravelQueueRabbitMQServiceProvider.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ class LaravelQueueRabbitMQServiceProvider extends ServiceProvider
1414
*/
1515
public function register()
1616
{
17-
/**
18-
* @var \Illuminate\Queue\QueueManager $manager
19-
*/
20-
$manager = $this->app['queue'];
21-
22-
$manager->addConnector('rabbitmq', function () {
23-
return new RabbitMQConnector;
17+
$this->app->booted(function () {
18+
/**
19+
* @var \Illuminate\Queue\QueueManager $manager
20+
*/
21+
$manager = $this->app['queue'];
22+
$manager->addConnector('rabbitmq', function () {
23+
return new RabbitMQConnector;
24+
});
2425
});
2526
}
2627

0 commit comments

Comments
 (0)