Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a Laravel queue worker.
Laravel
php artisan queue:[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'work' which does not start a queue worker.
Using 'listen' which listens for jobs but is less efficient than 'work'.
✗ Incorrect
The queue:work command starts a queue worker that processes jobs.
2fill in blank
mediumComplete the code to specify the queue connection when running a worker.
Laravel
php artisan queue:listen --[1]=redis Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--queue' which specifies the queue name, not the connection.
Using '--driver' which is not a valid option here.
✗ Incorrect
The --connection option specifies which queue connection to use.
3fill in blank
hardFix the error in the command to run a queue worker with a delay of 5 seconds.
Laravel
php artisan queue:work --delay=[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'five' which is not a number.
Using '5s' which includes units and causes an error.
✗ Incorrect
The delay option expects an integer number of seconds, so '5' is correct.
4fill in blank
hardFill both blanks to run a queue worker on the 'emails' queue with 3 tries.
Laravel
php artisan queue:work --queue=[1] --tries=[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong queue name like 'notifications'.
Setting tries to 5 instead of 3.
✗ Incorrect
The --queue option sets the queue name, and --tries sets the max attempts.
5fill in blank
hardFill all three blanks to run a queue worker on the 'default' queue, with 10 seconds delay and 2 tries.
Laravel
php artisan queue:work --queue=[1] --delay=[2] --tries=[3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'urgent' as queue name which is incorrect here.
Using delay or tries values other than 10 or 2.
✗ Incorrect
Use 'default' for the queue, '10' for delay seconds, and '2' for tries.