AMQPException Library error: table too large for buffer
I found a workaround: when the message is being redirected back to queue (to retry later) one huge stamp is being added In my serializer, in method 'encode' I filter stamps:
$allStamps = [];
foreach ($envelope->all() as $stampKey => $stamps) {
if ($stampKey === 'Symfony\Component\Messenger\Stamp\ErrorDetailsStamp') {
// this header could be huge and drasticaly increase a size of a message
continue;
}
$allStamps = array_merge($allStamps, $stamps);
}
return [
'body' => serialize($messageBody),
'headers' => [
// store stamps as a header - to be read in decode()
'stamps' => serialize($allStamps),
],
];