williamrijksen / symfony-messenger-azure
symfony/messenger 组件的 Azure 适配器
0.1.0
2018-12-12 15:19 UTC
Requires
- php: >=7.1.0
- ext-json: *
- microsoft/windowsazure: ^0.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14@dev
- jakub-onderka/php-parallel-lint: dev-master
- phpstan/phpstan: ^0.11.0@dev
- phpunit/phpunit: ^7.1@dev
- sebastian/phpcpd: ^4.0@dev
- symfony/config: ^4.1@dev
- symfony/dependency-injection: ^4.1@dev
- symfony/http-kernel: ^4.1@dev
- symfony/messenger: ^4.0@dev
- symfony/property-access: ^4.1@dev
- symfony/serializer: ^4.1@dev
Suggests
- ext-pcntl: *
This package is auto-updated.
Last update: 2024-09-14 04:56:40 UTC
README
这是 symfony/messenger 组件在 Azure 上用于主题和订阅者的一个实验性接收器/发送器。
快速开始
首先:这里使用主题/订阅方式,如这里所述。请确保您已准备好连接字符串。
目前我们提供了一个已预先配置了接收器和发送器的 Messenger 组件的包。
composer require symfony/messenger williamrijksen/symfony-messenger-azure
添加包 new WilliamRijksen\AzureMessengerAdapter\Bundle\AzureMessengerAdapterBundle()
。
添加以下配置
azure_messenger_adapter: azure: connectionString: 'Endpoint=<your token>' subscriptionName: 'name of subscription' #topic will be automatically created by this bundle messages: 'App\Message\Foo': 'foo_topic' #topic will be automatically created by this bundle
添加一个消息处理器
<?php namespace App\MessageHandler; use App\Message\Foo; final class FooHandler { public function __invoke(Foo $message) { } }
标记它
services: App\MessageHandler\FooHandler: tags: - { name: messenger.message_handler }
完成!
运行 bin/console messenger:consume-messages azure_messenger.receiver.foo_queue
从总线中分发消息
<?php $bus->dispatch(new Foo());
配置参考
azure_messenger_adapter: azure: connectionString: 'Endpoint=<your token>' subscriptionName: 'name of subscription' messages: 'App\Message\Foo': 'foo_topic'