laravel-queue-rabbitmq: Exception: no connector for [rabbitmq]
Hi there
Apologies for this issue, I’m sure it’s something I’m doing wrong. I have installed and configured the package, and with my default driver set to sync (or anything other than rabbitmq), my app boots fine:
vagrant@homestead:~/repos/gk$ php artisan tinker
Psy Shell v0.5.2 (PHP 5.6.10-1+deb.sury.org~trusty+1 — cli) by Justin Hileman
>>> $q = app('queue');
=> Illuminate\Queue\QueueManager {#182}
>>> $con = $q->connection('rabbitmq');
=> FintechFab\LaravelQueueRabbitMQ\Queue\RabbitMQQueue {#779
+"crypt": Illuminate\Encryption\McryptEncrypter {#191},
}
>>>
But as soon as I set 'default' => 'rabbitmq', I get exceptions:
vagrant@homestead:~/repos/gk$ php artisan
[InvalidArgumentException]
No connector for [rabbitmq]
vagrant@homestead:~/repos/gk$
The only think I can think of is that the rabbitmq driver isn’t available until the application has fully booted, but I’m not sure why that would be the case. The docs for this package suggest you can set QUEUE_DRIVER=rabbitmq in your .env file so I guess in theory I should be able to use it as my default driver. Any suggestions? (using L5.1)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 2
- Comments: 16 (7 by maintainers)
Found it 😃
The service provider is adding the connector inside
$this->app->booted(), so the app boots before the connector is added. One of our other service providers from a third party (Clockwork) was evidently doing something to cause the queue to be resolved before the app had booted, and consequently before our connector had been added.I’m not sure whether Clockwork should be doing something differently, or whether perhaps this package is adding the connector in too late? What would the effect be of removing the the
$this->app->booted()and just doing it as a normalregister()method? or perhaps move toboot()?Thanks