When a job throws an error instead of an exception the job is requeued forever. If only one consumer is working, the job will stay at the front of the queue forever. The error also bubbles up and causes the worker to crash which probably isn't desirable.
Example job:
<?php
declare(strict_types=1);
namespace App\Jobs;
use Cake\Queue\Job\JobInterface;
use Cake\Queue\Job\Message;
use Interop\Queue\Processor;
use TypeError;
class ErrorJob implements JobInterface
{
public function execute(Message $message): ?string
{
throw new TypeError('Something went sideways');
return Processor::ACK;
}
}
When a job throws an error instead of an exception the job is requeued forever. If only one consumer is working, the job will stay at the front of the queue forever. The error also bubbles up and causes the worker to crash which probably isn't desirable.
Example job: