spbaniya's avatar

How to retry a failed job to another queue name?

I'm using https://github.com/vyuldashev/laravel-queue-rabbitmq to implement RabbitMQ for queue. I want to retry the failed job (dispatched on abc queue) to another queue (xyz)

How would I do this?

0 likes
2 replies
bobbybouwmann's avatar
Level 88

You can dispatch the same job again with the same context to a different queue in your failed method of the job

public function failed(Exception $exception)
{
        dispatch(new MyJobClass($this->param1, $this->param2))->onQueue('xyz');
}

There is not really a standard way of doing this in Laravle, but it should do what you want ;)

Please or to participate in this conversation.