-
|
Hello friends! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
See the description of the middleware Redelivery will be occurred when consumer didn't ack nor reject the queue message - there is no way to know the root cause |
Beta Was this translation helpful? Give feedback.
-
|
@andrew-demb I forgot to text earlier but even now for the record and anyone else wasting time on this. Root Cause: AMQP Heartbeat Loss During Long-Running Message HandlersI spent a good amount of time debugging this exact issue and finally traced the root cause. Sharing here because the error message is genuinely misleading and there's very little documentation connecting these dots. Why There's No "Real Exception"There isn't one. Here's what actually happens:
That's why you see no application-level exception — your handler code never runs on the redelivered message. The middleware intercepts it first. The Timing MathThe critical relationship is: RabbitMQ considers a connection dead after Example with default/common settings:
How to Fix It1. Reduce your handler's maximum blocking timeThis is the most important fix. If your handler makes HTTP calls, set explicit timeouts: // Symfony HttpClient — per request
$response = $this->httpClient->request('POST', $url, [
'timeout' => 20, // max idle time between data chunks
'max_duration' => 25, // absolute max time for the entire request
'body' => $payload,
]);
// Or configure on the scoped client (recommended)
// config/packages/framework.yaml
framework:
http_client:
scoped_clients:
my_callback.client:
timeout: 20
max_duration: 25
2. Tune your AMQP transport DSNParameter guide:
The golden rule: With the example above: handler max = 25s, dead connection = 40s, read_timeout = 10s > heartbeat/2 = 10s. Everything fits. 3. Consider
|
Beta Was this translation helpful? Give feedback.
@andrew-demb I forgot to text earlier but even now for the record and anyone else wasting time on this.
Root Cause: AMQP Heartbeat Loss During Long-Running Message Handlers
I spent a good amount of time debugging this exact issue and finally traced the root cause. Sharing here because the error message is genuinely misleading and there's very little documentation connecting these dots.
Why There's No "Real Exception"
There isn't one.
RejectRedeliveredMessageExceptionis not hiding an underlying error — it is the error, but the cause is invisible because it happens at the AMQP protocol level, not in your PHP code.Here's what actually happens: