thomasvargiu/laminas-messenger
Composer 安装命令:
composer require thomasvargiu/laminas-messenger
包简介
Factories to use the Symfony Messenger in Laminas and Mezzio applications
关键字:
README 文档
README
Factories to use the Symfony Messenger in Laminas and Mezzio applications (ex zend-framework and zend-expressive)
Usage
You need to add console commands to your application. The following command services are already configured for you:
Symfony\Component\Messenger\Command\ConsumeMessagesCommandSymfony\Component\Messenger\Command\SetupTransportsCommandSymfony\Component\Messenger\Command\FailedMessagesRemoveCommandSymfony\Component\Messenger\Command\FailedMessagesRetryCommandSymfony\Component\Messenger\Command\FailedMessagesShowCommandSymfony\Component\Messenger\Command\StopWorkersCommand(see note below)
To use the Symfony\Component\Messenger\Command\StopWorkersCommand command you should set a CacheItemPoolInterface
implementation (see below).
A default message bus is already configured for you with the following service name: messenger.bus.default.
You can read the Symfony documentation to know
how to use it.
Configuration
This is an example configuration:
use TMV\Laminas\Messenger\Factory; use Symfony\Component\Messenger; return [ 'dependencies' => [ 'factories' => [ 'messenger.bus.foo' => [Factory\MessageBusFactory::class, 'messenger.bus.foo'], // the name must be the same as the bus configuration key 'messenger.transport.async' => [Factory\Transport\TransportFactory::class, 'messenger.transport.async'], // the name must be the same as the transport configuration key ], ], 'messenger' => [ 'failure_transport' => null, // your failure transport service name (optional) 'logger' => null, // your custom logger service name (optional) 'default_serializer' => SFMessenger\Transport\Serialization\PhpSerializer::class, // default messenger serializer, it should be a service name 'cache_pool_for_restart_signal' => null, // CacheItemPoolInterface service name implementation if you want to use stop workers command 'transport_factories' => [ // here you can add your custom transport factories services ], 'subscribers' => [], // Subscribers (service name) to use with the default event dispatcher factory 'buses' => [ 'messenger.bus.foo' => [ // bus service name, it should be registered as a service with the same name 'default_middleware' => true, // if you want to include default middleware (default: true) 'middleware' => [ // your custom middleware service names My\FooMiddleware::class, ], 'allow_no_handler' => false, // allow no handlers (default: false) 'handlers' => [ // your handlers My\FooMessageType::class => [ My\FooMessageHandler::class, ], ], 'routes' => [ My\FooMessageType::class => ['messenger.transport.async'], // route message types to this transport ], ], ], 'transports' => [ 'messenger.transport.async' => [ 'dsn' => 'amqp://guest:guest@rabbitmq:5672', 'serializer' => Messenger\Transport\Serialization\PhpSerializer::class, // custom serializer service 'options' => [ 'exchange' => [ 'name' => 'messenger_events', ], 'queues' => [ 'messenger_events' => [], ], ], 'retry_strategy' => [ 'max_retries' => 3, 'delay' => 1000, 'multiplier' => 2, 'max_delay' => 0, ], ], ], ], ];
Doctrine Helpers
Middlewares
There are some middleware available for Doctrine:
TMV\Laminas\Messenger\Middleware\DoctrineCloseConnectionMiddleware
Close connection on every message consumed by the worker.
TMV\Laminas\Messenger\Middleware\DoctrinePingConnectionMiddleware
Before to handle a message on worker, ping to check whether the connection is open or try to reconnect it.
TMV\Laminas\Messenger\Middleware\DoctrineTransactionMiddleware
For every message, wrap the message handler with a transaction.
Subscribers
TMV\Laminas\Messenger\Subscriber\DoctrineClearEntityManagerWorkerSubscriber
This subscriber clear the EntityManager after a message is handled in a worker.
thomasvargiu/laminas-messenger 适用场景与选型建议
thomasvargiu/laminas-messenger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 54.55k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2020 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「zend」 「module」 「message」 「AMQP」 「messaging」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 thomasvargiu/laminas-messenger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thomasvargiu/laminas-messenger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 thomasvargiu/laminas-messenger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
Polyfill for mb_ereg(), mb_eregi(), mb_ereg_match(), and mb_ereg_replace*() functions; primary use case is for mbstring on Windows 7.4+
Zend Framework 1 Http package
Zend Framework 1 Soap package
Bundle Symfony DaplosBundle
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
统计信息
- 总下载量: 54.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-21