apolinux/processmanager 问题修复 & 功能扩展

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

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

apolinux/processmanager

Composer 安装命令:

composer require apolinux/processmanager

包简介

System Process Manager written in PHP

README 文档

README

Process Manager written in PHP

Controls a pool of subprocesses and send them messages using queue. This first version uses beanstalk to communicate processes.

There is a task that sends data to children through the queue. The other processes read this data from queue and process it.

The main loop waits for the children finish to end script.

Example

example of use:

<?php

use ProcessManager\Beanstalk;
use ProcessManager\QueueManager;

require_once __DIR__ . '/../vendor/autoload.php' ;


$beanstalk = new Beanstalk(['host' => 'localhost']);

$beanstalk->setTube("send-msgs");

$beanstalk->clearTube();
$beanstalk->clearConn();

$queuemngr = new QueueManager($beanstalk) ;

// consumer job
$callable_task = function($queue, $cont){
   for($cont=1; $cont<=4; $cont++){
        $msg = $queue->readMsg();
        echo "in task $cont. msg: $msg\n" ;
   }
};

$num_tasks= 3;

for($cont=1 ; $cont<=$num_tasks; $cont++){
    $queuemngr->addTask( $callable_task , [$cont] );
}

// in producer job, send info to children using queue
$queuemngr->addTask(function($queuemngr){
    $msg_pending = explode(" ","El amor es como la vida y la naturaleza lo es todo") ;

    foreach($msg_pending as $msg) {
         $queuemngr->sendMsg($msg);
    }
});
// fork and run tasks 
$queuemngr->run();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-03-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固