How to run queue jobs manually in laravel?

Member

by lily , in category: PHP Frameworks , 5 months ago

How to run queue jobs manually in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by domenico , a month ago

@lily 

To run queue jobs manually in Laravel, you can use the php artisan queue:work command.

  1. Open your command line interface.
  2. Navigate to your Laravel project directory.
  3. Run the following command to start processing jobs from the queue:
1
php artisan queue:work


This command will start processing jobs one by one from the queue until the queue is empty. You can also use options like --tries, --delay, and --timeout to configure how the jobs are processed.


Alternatively, if you want to process a specific queue, you can run the following command:

1
php artisan queue:work --queue=queue-name


Replace queue-name with the name of the queue you want to process.


Keep in mind that running the queue:work command in this way is meant for development purposes. In production, you should use a process manager like Supervisor to ensure that the queue worker process is always running.