Download the PHP package pupilcp/swoole-multi-consumer without Composer

On this page you can find all versions of the php package pupilcp/swoole-multi-consumer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package swoole-multi-consumer

PHP版本 swoole-multi-consumer

简介

swoole-multi-consumer(简称smc-server)使用PHP实现,使用swoole多进程消费者订阅消息,实现自动监控队列的数量,自动伸缩消费者数量,并实现核心配置文件的热加载,目前暂时支持rabbitmq。

说明

业务功能的实现都在自身的PHP项目中,smc-server通过方法回调[PHP项目中的方法]进行队列消息的处理和配置文件热加载

功能实现

  1. 多进程订阅队列消息。
  2. 监控队列消息的数量,并自动调整的消费者的数量。
  3. 实现核心配置文件的热加载,不用重启服务,smc-server会自动检测并实现子进程的重启。

特点

  1. 使用swoole process派生子进程,多进程订阅消息队列的数据。
  2. 使用swoole\tick定时器监控队列消息积压的情况并使用redis进行记录,实现系统预警以及消费者数量的自动调整。
  3. 使用swoole\tick定时检测队列配置的信息,实现热加载。
  4. 通过call_user_func_array方法回调处理消息,可以与任何PHP框架无缝结合。

设计模型

安装

环境依赖:

  1. php >= 7.0
  2. swoole扩展 >= 1.10.0 //建议并推荐使用4.0.0版本以上
  3. redis扩展 >= 3.0 //建议4.0版本以上
  4. amqp扩展
接入框架:

使用

复制根目录下的globalConfig.demo.php,并重命名为:globalConfig.php,修改配置文件里的参数。 主要配置说明:

$globalConfig.php里,系统会使用call_user_func_array($globalConfig['global']['queueCfgCallback'])加载队列相关的配置,上述例子是通过调用\Pupilcp\Service\Test中loadQueueConfig方法进行加载,该方法内容如下:

备注:也可以将queueConfig.php(queueConfig.demo.php重命名)结构的内容存储到mysql、es、redis等存储服务,通过\Pupilcp\Service\Test中loadQueueConfig方法进行加载即可。smc-server会检测此回调方法,实现队列配置热加载。

启动smc-server,以Yii2框架为示例

  1. 使用Yii2框架自带的console。
  2. 编写command文件,举例文件名为:TestController,内容如下:

  3. 启动命令 sudo -u www /PATH/yii test/test

备注:smc-server启动后为常驻进程,其它框架类似做法。

注意事项

smc-server使用回调queueConfig.php中queues配置下callback,请不要在此方法执行流程中的任何地方使用die和exit,否则会导致子进程退出,订阅队列的消费者会被剔除。

支持

swoole

其它

如有疑问,请邮件联系:[email protected]


All versions of swoole-multi-consumer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-swoole Version >=1.10.0
ext-redis Version >=3.0
ext-amqp Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pupilcp/swoole-multi-consumer contains the following files

Loading the files please wait ....