承接 tahoelimited/qpush-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tahoelimited/qpush-bundle

Composer 安装命令:

composer require tahoelimited/qpush-bundle

包简介

Asynchronous processing for Symfony using Push Queues

README 文档

README

Build Status Quality Score Code Coverage Total Downloads

##Overview This bundle allows you to easily consume messages from Push Queues by simply tagging your services and relying on Symfony's event dispatcher - without needing to run a daemon or background process to continuously poll your queue.

Full Documentation: qpush-bundle.readthedocs.org

##Installation

The bundle should be installed through composer.

####Add the bundle to your composer.json file

{
    "require": {
        "uecode/qpush-bundle": "~2.1.0",
    }
}

####Update AppKernel.php of your Symfony Application

Add the UecodeQPushBundle to your kernel bootstrap sequence, in the $bundles array.

public function registerBundles()
{
    $bundles = array(
        // ...
        new Uecode\Bundle\QPushBundle\UecodeQPushBundle(),
    );

    return $bundles;
}

##Basic Configuration:

Here is a basic configuration that would create a push queue called my_queue_name using AWS or IronMQ. You can read about the supported providers and provider options in the full documentation.

######Example

#app/config.yml

uecode_qpush:
    providers:
        ironmq:
            token:      YOUR_IRON_MQ_TOKEN_HERE
            project_id: YOUR_IRON_MQ_PROJECT_ID_HERE
        aws:
            key:    YOUR_AWS_KEY_HERE
            secret: YOUR_AWS_SECRET_HERE
            region: YOUR_AWS_REGION_HERE
    queues:
        my_queue_key:
            provider: ironmq #or aws
            options:
                queue_name: my_queue_name #optional. the queue name used on the provider
                push_notifications: true
                subscribers:
                    - { endpoint: http://example.com/qpush, protocol: http }

##Publishing messages to your Queue

Publishing messages is simple - fetch the registered Provider service from the container and call the publish method on the respective queue.

This bundle stores your messages as a json object and the publish method expects an array, typically associative.

######Example

// src/My/Bundle/ExampleBundle/Controller/MyController.php

public function publishAction()
{
    $message = ['foo' => 'bar'];

    // fetch your provider service from the container
    $this->get('uecode_qpush')->get('my_queue_key')->publish($message);

    // you can also fetch it directly
    $this->get('uecode_qpush.my_queue_key')->publish($message);
}

##Working with messages from your Queue

When a message hits your application, this bundle will dispatch a MessageEvent which can be handled by your services. You need to tag your services to handle these events.

######Example

services:
    my_example_service:
    	class: My\Bundle\ExampleBundle\Service\ExampleService
    	tags:
    		- { name: uecode_qpush.event_listener, event: my_queue_key.message_received, method: onMessageReceived }

######Example

// src/My/Bundle/ExampleBundle/Service/ExampleService.php

use Uecode\Bundle\QPushBundle\Event\MessageEvent;

public function onMessageReceived(MessageEvent $event)
{
    $queue_name = $event->getQueueName();
    $message    = $event->getMessage();

    // do some processing
}

The Message objects contain the provider specific message id, a message body, and a collection of provider specific metadata.

These properties are accessible through simple getters from the message object.

######Example

// src/My/Bundle/ExampleBundle/Service/ExampleService.php

use Uecode\Bundle\QPushBundle\Event\MessageEvent;
use Uecode\Bundle\QPushBundle\Message\Message;

public function onMessageReceived(MessageEvent $event)
{
    $id         = $event->getMessage()->getId();
    $body       = $event->getMessage()->getBody();
    $metadata   = $event->getMessage()->getMetadata();

    // do some processing
}

###Cleaning up the Queue

Once all other Event Listeners have been invoked on a MessageEvent, the Bundle will automatically attempt to remove the Message from your Queue for you.

tahoelimited/qpush-bundle 适用场景与选型建议

tahoelimited/qpush-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 154 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「bundle」 「aws」 「push」 「qpush」 「pub-sub」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 tahoelimited/qpush-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tahoelimited/qpush-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 tahoelimited/qpush-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 154
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 54
  • 开发语言: PHP

其他信息

  • 授权协议: Apache
  • 更新时间: 2015-04-07