-
Notifications
You must be signed in to change notification settings - Fork 440
Description
I just ran into this problem where a message that could not be processed and was rejected with requeue true just kept being processed (and not passing) over and over.
After looking at the DBalConsumer reject code, it seems to be entirely logically wrong;
public function reject(Message $message, bool $requeue = false): void
{
InvalidMessageException::assertMessageInstanceOf($message, DbalMessage::class);
if ($requeue) {
$message = clone $message;
$message->setRedelivered(false);
$this->getContext()->createProducer()->send($this->queue, $message);
}
$this->acknowledge($message);
}
What this does is clone the message as-is, specifically set redelivered to false instead of true (which one would expect), doesn't add any delays, even though the redeliveryDelay is configured, but never used.
It would seem to me that the logic here is very wrong. I would expect it to set redelivered to true and add the redeliverDelay and then just update the message.
I also don't get why it has to be cloned and then acknowledged, but that may be an adapter oddity.
Am I correct in my assumption that this is faulty logic, or is there a reason it works this way that I'm not clear on?