symfony-bundles/queue-bundle 问题修复 & 功能扩展

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

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

symfony-bundles/queue-bundle

最新稳定版本:v2.0.0

Composer 安装命令:

composer require symfony-bundles/queue-bundle

包简介

Symfony Queue Bundle

README 文档

README

SensioLabsInsight

Build Status Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version License

Installation

  • Require the bundle with composer:
composer require symfony-bundles/queue-bundle
  • Enable the bundle in the kernel:
public function registerBundles()
{
    $bundles = [
        // ...
        new SymfonyBundles\QueueBundle\SymfonyBundlesQueueBundle(),
        // ...
    ];
    ...
}
  • Configure the queue bundle in your config.yml.

Defaults configuration:

sb_queue:
    service:
        alias: 'queue' # alias for service `sb_queue` (e.g. $this->get('queue'))
        class: 'SymfonyBundles\QueueBundle\Service\Queue'
        storage: 'redis' # storage key from `queue.storages` section
    settings:
        queue_default_name: 'queue:default' # default name for queue
    storages:
        redis:
            class: 'SymfonyBundles\QueueBundle\Service\Storage\RedisStorage'
            client: 'sb_redis.client.default' # storage client service id

How to use

A simple example of the use of the queue:

$queue = $this->get('sb_queue'); // get the service
// or use: $this->get('queue'); the `queue` service use as alias,
// which setting in config.yml in parameter `sb_queue.service.alias`

// adding some data to queue
$queue->push('User "demo" registered');
$queue->push(1234567890);
$queue->push(new \stdClass);

// get count of items from queue
$queue->count(); // returns integer: 3
// now, we can get the data at any time in the queue order

// get data from queue
$queue->pop(); // returns string: User "demo" registered
$queue->count(); // returns integer: 2
$queue->pop(); // returns integer: 1234567890
$queue->count(); // returns integer: 1
$queue->pop(); // returns object: object(stdClass)
$queue->count(); // returns integer: 0

If you want to change the queue:

// adding data to queue `notifications`
$queue->setName('application:notifications');
$queue->push('You have a new message from Jessica');

// adding data to queue `settings`
$queue->setName('account:settings');
$queue->push('User with ID 123 changed password');

// adding data to default queue
$queue->setName('queue:default');
$queue->push('To be or not to be');

统计信息

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

GitHub 信息

  • Stars: 31
  • Watchers: 7
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固