Search code examples
phplaravelrabbitmqphp-amqplibphp-amqp

LaravelQueueRabbitMQ plugin timing out on StreamIO.php


I'm having trouble setting up the LaravelQueueRabbitMQ plugin on a Laravel 5.1 project. Here's the repository for the plugin:

https://github.com/vladimir-yuldashev/laravel-queue-rabbitmq/tree/v5.1

I have installed the package, added the required service provider to the app.php file, configured the queue.php file and added the relevant entries to my .env file to point to my RabbitMQ server.

However when I try to queue a job like this

$this->dispatch(new TestQueue);

I receive the following error:

FatalErrorException in StreamIO.php line 212:

Maximum execution time of 30 seconds exceeded

After some debugging, it appears the problem is occurring in the AbstractConnection.php file in the connect() method. Specifically, line 205 is where the script stops and causes the maximum execution time.

Strangely, I have another Laravel project running on the same PC which is running on version 5.2. It uses the same LaravelQueueRabbitMQ plugin but the 5.2 version, and this works fine - jobs appear in the queue instantly.

I'm running out of ideas and I haven't seen anyone else with a similar problem. Can anyone point me in the right direction?


Solution

  • I had the same issue and was getting a timeout in the StreamIO.php file.

    First thing is to check the default driver is set to rabbitmq in the queue.php file or in your .env file if it is defined in here instead. Then if you are using a cached configuration run:

     php artisan cache:clear
    

    to clear the cache and then:

    php artisan config:cache
    

    to reset the cache.

    If this doesn't work you can also try restarting the rabbitmq app by opening the RabbitMQ command prompt and using the command:

    rabbitmqctl stop_app
    

    followed by

    rabbitmqctl start_app
    

    Restarting was what solved the error for me. Hope this helps :)