bbit / async-dispatcher-bundle
symfony BBITAsyncDispatcherBundle
2.6
2016-12-22 11:52 UTC
Requires
- php: >=5.3.2
Requires (Dev)
- satooshi/php-coveralls: v0.6.1
- symfony/symfony: >=2.4.0
This package is not auto-updated.
Last update: 2024-09-20 21:37:29 UTC
README
AsyncDispatcherBundle 是一个简单的bundle,它为您提供异步事件分发器,该分发器将事件存储直到kernel.terminate,然后使用常规事件分发器触发它们。
步骤 1: 使用 composer 下载 BBITAsyncDispatcherBundle
在您的 composer.json 中添加 BBITAsyncDispatcherBundle:(使用最新稳定版,NOT dev-master)
{ "require": { "bbit/async-dispatcher-bundle": "2.5.0", } }
现在运行以下命令告诉 composer 下载该bundle
$ php composer.phar update bbit/async-dispatcher-bundle
Composer 将安装bundle到项目的 vendor/BBIT
目录。
步骤 2: 启用bundle
在kernel中启用bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new BBIT\AsyncDispatcherBundle\BBITAsyncDispatcherBundle(), ); }
用法
$dispatcher = $this->container->get('bbit_async_dispatcher.dispatcher'); // get dispatcher service $dispatcher->addAsyncEvent('name_of_the.event', new CustomEvent($entity));
更多BBIT Bundles
SqsCommandQueueBundle 是一个简单的bundle,您可以使用它来在Amazon SQS上排队命令。然后可以由一个或多个工作进程异步处理这些命令。