piteer1/celery-php 问题修复 & 功能扩展

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

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

piteer1/celery-php

Composer 安装命令:

composer require piteer1/celery-php

包简介

README 文档

README

What is it?

This library allows to add tasks for celery using different backends and simplifies access to it.

Usage example

<?php
//create new celery redis class
use Celery;
use Celery\Backend\Factory;

$celery = new Celery(
    Factory::factory('redis', array(/*host port etc*/));
);

//you can also create by hand instance of Redis backend
use Celery\Backend\Redis;
use Celery\Backend\RedisOptions;

$celery = new Celery(
    new Redis(
        RedisOptions(
            array(
                //host port etc.
            )
        )
    )
);

$celery->pushTask(
        $exchangeName,
        $queueName,
        $taskName,
        $exchangeType,
        array $args
    );
?>

Unittests

To run unittests be sure fistly to run

make init

Later you should be able to use

make phpunit

It's also possible to use phpunit from your system installation. If you have it already installed just

cd tests
phpunit

Be sure thought to still run make init because it will install necessary Mockery.

Additionally you will need a phpredis extension installed and added to PHP. You can find phpredis in vendor directory if you'll run make composer / make init.

Developer instructions

To add new Celery backend you should create two classes of name:

  • BackendName in Celery/Backend/BackendName.php file
  • BackendNameOptions in Celery/Backend/BackendNameOptions.php file

First class should implement BackendInterface (can also extend BackendAbstract class). This class handles task itself encapsulating backend specific functions (it's an Adapter).

Second class should encapsulate backend specific initialization.

If one of backends cannot implement one of the methods required by interface because it doesn't support one of the exchange type, it should throw an exception Celery\Exception\NotSupportedExchangeTypeException

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-12-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固