Transport decorator that removes ErrorDetailsStamp and RedeliveryStamp before sending messages to AMQP.
When Symfony Messenger retries failed messages, it adds stamps containing:
ErrorDetailsStamp: Exception class name, message, and full stack traceRedeliveryStamp: Retry metadata with exception details
On each retry, new stamps are added, causing accumulation. After several retries, the AMQP headers become too large, resulting in:
- "Invalid AMQP data" errors
- "table too large for buffer" errors
This decorator wraps AMQP transports and strips ErrorDetailsStamp and RedeliveryStamp before send(), keeping messages within AMQP header limits.
Yes. Both ErrorDetailsStamp and RedeliveryStamp are purely informational/diagnostic - they don't control retry behavior.
The retry mechanism is controlled by:
DelayStamp- controls retry delay timing- Retry count and strategy from
messenger.yamlconfig
These are not removed by this decorator.
- Message fails ->
ErrorDetailsStampandRedeliveryStampadded (in memory) - Retry logic kicks in (based on retry strategy)
send()called -> stamps removed by this decorator- Message sent to AMQP without large headers
- Worker picks it up, retries execution
- If fails again -> new stamps added -> cycle repeats
You lose error details history in the message headers, but the messages continue to retry correctly.
composer require recranet/messenger-amqp-decoratedIf you're using Symfony Flex, the bundle is registered automatically.
Otherwise, add it to config/bundles.php:
return [
// ...
Recranet\MessengerAmqpDecorated\MessengerAmqpDecoratedBundle::class => ['all' => true],
];No configuration needed. The bundle automatically decorates messenger.transport.amqp.factory, wrapping all AMQP transports.