t3n/JobQueue.RabbitMQ

Support for Dead Letter Exchanges

Closed this issue · 2 comments

It should be possible to configure the RabbitQueue to use a DLX https://www.rabbitmq.com/dlx.html instead of the current requeueing mechanism.

Proposal: Add a configuration option to enable usage of a DLX.

If a DLX is in use, the release function could look like this:

public function release(string $messageId, array $options = []): void
{
    $this->channel->basic_nack($messageId);
}

This way, the message would not have to be requeued using the ReleaseService. Once that works, the x-death message header can be used to track the retry count of the message header.

Background:
I publish the jobs to a fanout exchange so multiple workers receive the same message. When a message fails, it is published to that exchange again, leading to duplicate messages in all worker queues.

@johannessteu: I'd be happy to implement this if you don't mind.

Sure! I'll have a look at it in a few!