bbit/sqs-command-queue-bundle

symfony BBITSqsCommandQueueBundle

v1.0 2015-10-21 09:57 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:20:29 UTC


README

Latest Stable Version

SqsCommandQueueBundle 是一个简单的包,您可以使用它来在亚马逊 SQS 上排队命令。然后,此包提供一个工作进程,可以在多个服务器上运行,并将执行命令,在一个工作进程中。

步骤 1:使用 composer 下载 BBITSqsCommandQueueBundle

在 composer.json 中添加 BBITSqsCommandQueueBundle

{
    "require": {
        "bbit/sqs-command-queue-bundle": "dev-master",
    }
}

现在运行以下命令让 composer 下载该包

$ php composer.phar update bbit/sqs-command-queue-bundlee

Composer 将该包安装到您的项目目录 vendor/BBIT 中。

步骤 2:启用包

在内核中启用该包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new BBIT\SqsCommandQueueBundle\BBITSqsCommandQueueBundle(),
    );
}

步骤 3:配置包

bbit_sqs_command_queue:
    aws_sqs_key: xxx
    aws_sqs_secret: xxxxxxxxx
    aws_sqs_region: eu-central-1
    aws_sqs_queue: https://sqs.eu-central-1.amazonaws.com/xx11xx11/xx-xx

用法

向队列发送命令

$container->get('sqs_queue')->addCommand('app/console cache:clear');

工作进程

app/console bbit:sqs-command-queue:work 

更多 BBIT 包

AsyncDispatcherBundle 是一个简单的包,它为您提供了一个异步事件分派器,该分派器将事件存储直到内核终止,然后使用常规事件分派器触发它们。 Latest Stable Version