aymdev/messenger-azure-bundle 问题修复 & 功能扩展

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

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

aymdev/messenger-azure-bundle

Composer 安装命令:

composer require aymdev/messenger-azure-bundle

包简介

Symfony Messenger bundle for Azure Service Bus

README 文档

README

A PHP 8.4+ & Symfony 6 / 7 / 8 bundle providing a Symfony Messenger transport for Azure Service Bus using the Azure REST API.

Testing Coding Standards Bundle installation Latest Stable Version License

Installation

You only need to install the bundle using Composer:

composer require aymdev/messenger-azure-bundle

As it uses Symfony HttpClient, you will need to install a PSR-18 client. Example:

composer require nyholm/psr7

Configuration

Transport DSN

Your DSN must respect the following format to build the authentication header for a specific namespace:

azure://KEY_NAME:KEY_VALUE@NAMESPACE

Where KEY_NAME is your shared access key name, KEY_VALUE is your shared access key and NAMESPACE is your Azure Service Bus namespace. Important note: the keys can contain special characters that could break the URL parsing. Be sure to URL encode them.

Transport options

Detailed list of transport options:

Option name Description Required Default value
entity_path The topic or queue name. Yes
subscription The subcription name to consume messages from a topic. Only for topic consumer transports
token_expiry SAS token validity duration in seconds. 3600
receive_mode Set to peek-lock to perform a non destructive read or to receive-and-delete to perform a destructive-read peek-lock

Example config/packages/messenger.yaml:

framework:
    messenger:
        transports:
            azure_transport:
                dsn: '%env(AZURE_SERVICE_BUS_DSN)%'
                serializer: 'App\Messenger\YourAzureSerializer'
                options:
                    entity_path: 'your-topic'
                    subscription: 'subscription-name'
                    token_expiry: 60
                    receive_mode: 'receive-and-delete'

Stamps

This transport provides a few stamps:

AzureMessageStamp

The AymDev\MessengerAzureBundle\Messenger\Stamp\AzureMessageStamp stamp is added to sent and received messages and contains:

  • the topic or queue name
  • the original sent/received message
  • the subscription name for received messages from topics
  • the delete URL for received messages in peek-lock receive mode

AzureBrokerPropertiesStamp

The AymDev\MessengerAzureBundle\Messenger\Stamp\AzureBrokerPropertiesStamp stamp is used for the message properties. It is automatically decoded when consuming a message and is encoded when producing a message if added to the envelope.

Serialization

Creating your serializers

There is no serializer provided, but here is the expected array structure of an encoded envelope:

  • body: your plain text message
  • headers: optional HTTP headers (either received from Azure Service Bus response or to send to the REST API)

Logging decoding errors

When a serializer throws a Symfony\Component\Messenger\Exception\MessageDecodingFailedException while decoding a message, it will be converted to a AymDev\MessengerAzureBundle\Messenger\Exception\SerializerDecodingException which contains an envelope with an empty message but with the same stamps as a successfully decoded message.

You can then listen to the console.error Symfony event and get the topic/queue name where then decoding failure happened, the original message, etc.

aymdev/messenger-azure-bundle 适用场景与选型建议

aymdev/messenger-azure-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 252.3k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2022 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 aymdev/messenger-azure-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aymdev/messenger-azure-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 aymdev/messenger-azure-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 13
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-10