定制 recranet/messenger-amqp-decorated 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

recranet/messenger-amqp-decorated

最新稳定版本:1.0.0

Composer 安装命令:

composer require recranet/messenger-amqp-decorated

包简介

Transport decorator that removes ErrorDetailsStamp before sending messages to AMQP

README 文档

README

Transport decorator that removes ErrorDetailsStamp and RedeliveryStamp before sending messages to AMQP.

Problem Solved

When Symfony Messenger retries failed messages, it adds stamps containing:

  • ErrorDetailsStamp: Exception class name, message, and full stack trace
  • RedeliveryStamp: 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

Solution

This decorator wraps AMQP transports and strips ErrorDetailsStamp and RedeliveryStamp before send(), keeping messages within AMQP header limits.

Are Failed Messages Still Retried?

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.yaml config

These are not removed by this decorator.

Flow

  1. Message fails -> ErrorDetailsStamp and RedeliveryStamp added (in memory)
  2. Retry logic kicks in (based on retry strategy)
  3. send() called -> stamps removed by this decorator
  4. Message sent to AMQP without large headers
  5. Worker picks it up, retries execution
  6. If fails again -> new stamps added -> cycle repeats

Trade-off

You lose error details history in the message headers, but the messages continue to retry correctly.

Installation

composer require recranet/messenger-amqp-decorated

If you're using Symfony Flex, the bundle is registered automatically.

Otherwise, add it to config/bundles.php:

return [
    // ...
    Recranet\MessengerAmqpDecorated\MessengerAmqpDecoratedBundle::class => ['all' => true],
];

Usage

No configuration needed. The bundle automatically decorates messenger.transport.amqp.factory, wrapping all AMQP transports.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-22