Skip to content

Queue Worker Looping when Job Throws Error #111

@amayer5125

Description

@amayer5125

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;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions