bentools/safe-sync-transport 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bentools/safe-sync-transport

Composer 安装命令:

composer require bentools/safe-sync-transport

包简介

Symfony Messenger safe synchronous transport.

README 文档

README

This package offers Symfony Messenger's sync:// transport a different approach:

  • Messages are handled synchronously, like in sync:// transport ✅

But:

  • In case of failure (handler produces an exception), messages can be retried (whereas original sync:// throws the exception and crashes) 👉
  • When max retries have been reached, messages can fall into the failure_transport ☝️

This way, safe-sync:// can be used as a drop-in replacement of any asynchronous transport, following the same logic (except messages are now processed synchronously). 👍

Whenever an exception is thrown during message handling, it is caught by the transport, which applies the rules you defined within your messenger.yaml.

Installation

composer require bentools/safe-sync-transport

Usage

Example:

# config/packages/messenger.yaml
framework:
  messenger:
    failure_transport: failed
    transports:
      sync:
        dsn: 'safe-sync://'
        retry_strategy:
          max_retries: 3
          delay: 100
          multiplier: 2
      failed:
        dsn: 'doctrine://default'
    
    routing:
      App\DummyMessage: sync

Tests

composer test

License

MIT.

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-28