Holly Grant
Holly Grant

Reputation: 121

Laravel Queue Driver not calling handle() on jobs, but queue:listen daemon is logging jobs as processed

I've taken over a Laravel 5.2 project where handle() was being called successfully with the sync queue driver.

I need a driver that supports dispatch(..)->delay(..) and have attempted to configure both database and beanstalkd, with numerous variations, unsuccessfully - handle() is no longer getting called.

Current setup

I am using Forge for server management and have set up a daemon, which is automatically kept running by Supervisor, for this command:

php /home/forge/my.domain.com/envoyer/current/artisan queue:listen --sleep=3 --tries=3

I've also tried queue:work, naming 'database/beanstalkd', with and without specifying --sleep, --tries , --deamon

I have an active beanstalkd worker running on forge.

I have set the default driver to beanstalkd in \config\queue.php and QUEUE_DRIVER=beanstalkd in my .env from within Envoyer, which has worked fine for other environment variables.

After build deployment Envoyer runs the following commands successfully:

php artisan config:clear
php artisan migrate
php artisan cache:clear
php artisan queue:restart

Debug information

My queue:listen daemon produces log within .forge says it processed a job!

[2017-07-04 08:59:13] Processed: App\Jobs\GenerateRailwayReport

Where that job class is defined like this:

class GenerateRailwayReport extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;
    protected $task_id;

    public function __construct($task_id)
    {
        $this->task_id = $task_id;
        clock("GenerateRailwayReport constructed"); // Logs Fine
    }

    public function handle()
    {
        clock("Handling Generation of railway report"); // Never Logs
        //Bunch of stuff all commented out during my testing
    }

    public function failed(Exception $e)
    {
        clock("Task failed with exception:"); // Never Logs
        clock($e);
    }
}

My beanstalkd worker log within .forge has no output in it.

Nothing in my failed_jobs table.

-Really, really appreciate any help at this point!

Upvotes: 11

Views: 4427

Answers (1)

ricardo tulio
ricardo tulio

Reputation: 1

try adding Dispatchable and Queueable to your use

use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

Upvotes: 0

Related Questions