Laravel Jobs Queue

Asked

Viewed 2,182 times

2

I’m having a question, I’m trying to run the Jobs using the Supervisor to run Jobs, only the command doesn’t work with php Artisan Queue:work rather with php Artisan Queue:work --Queue=high, I’m using QUEUE_DRIVER as a database, but I don’t think it interferes... the command I add the Jobs to the queue is

\App\Jobs\S3Migration::dispatch($file)->onQueue('Migration');

I run the page that has this code and add everything to the queue, only if the Supervisor settings call the php Artisan Queue:work doesn’t work, just running with php Artisan Queue:work --Queue=high,... is it something I have to put in order for you to perform the tasks? or some other configuration I have to put in the Supervisor?

2 answers

1

Although it’s been a few months, I imagine you’ve already found the answer, anyway, here’s the answer.

You are "dispatching" to a specific Forum, in this case the "Migration", why the php artisan queue:work, by default, dispatch using "default Queue", however, you can change the default behavior by changing the file app/Console/Kernel.php.

As documentation on Queues

// This job is sent to the default queue...
Job::dispatch();

// This job is sent to the "emails" queue...
Job::dispatch()->onQueue('emails');

It is not a very complete article but it helped me in some initial doubts about queues and Jobs. Scheduler: Queues - Multiple Queues

  • opa, I decided, I am actually managing for the Laravel Horizon and in the config of the Horrizon define my Queues

0

I’m using the Laravel Horizon to manage Queues

 'local' => [
        'supervisor-1' => [
            'connection' => 'redis',
            'queue' => ['default','Migration','Upload'],
            'balance' => 'simple',
            'processes' => 3,
            'tries' => 3,
        ],
    ],

Browser other questions tagged

You are not signed in. Login or sign up in order to post.