php-supervisor-event

用于与Supervisor事件通知交互的PHP类。(PHP classes for interacting with Supervisor event notifications.)

  • 所有者: mtdowling/php-supervisor-event
  • 平台: BSD, Linux, Mac, Windows
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

PHP Supervisor Event Framework

Receives event notifications from Supervisor and sends the parsed notification
to a callback function.

Requirements

  • PHP 5.3
  • Supervisord

Installation

The recommended installation method is through Composer.

  1. Add mtdowling/supervisor-event as a dependency in your project's composer.json file:

     {
         "require": {
             "mtdowling/supervisor-event": "*"
         }
     }
    
  2. Download and install Composer:

     curl -s http://getcomposer.org/installer, php
    
  3. Install your dependencies:

     php composer.phar install
    
  4. Require Composer's autoloader

    Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process:

     require 'vendor/autoload.php';
    

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

Example event script

<?php

// include the composer autoloader
require_once __DIR__ . '/vendor/autoload.php';

use Mtdowling\Supervisor\EventListener;
use Mtdowling\Supervisor\EventNotification;

$listener = new EventListener();
$listener->listen(function(EventListener $listener, EventNotification $event) {
    $listener->log($event->getEventName());
    $listener->log($event->getServer());
    $listener->log($event->getPool());
    // Try messing around with supervisorctl to restart processes and see what
    // data is available
    $listener->log(var_export($event->getData(), true));
    return true;
});

Running the example

Open your supervisord.conf file and add the following:

[eventlistener:event_listener]
command=php /path/to/examples/log.php
process_name=%(program_name)s_%(process_num)02d
numprocs=1
events=PROCESS_STATE_STARTING,TICK_5
autostart=true
autorestart=unexpected

Replace /path/to with the correct path. More event listener options can be
found at http://supervisord.org/events.html

Now run:

supervisorctl reload

主要指标

概览
名称与所有者mtdowling/php-supervisor-event
主编程语言PHP
编程语言PHP (语言数: 1)
平台BSD, Linux, Mac, Windows
许可证MIT License
所有者活动
创建于2011-08-11 01:18:02
推送于2019-11-12 06:50:32
最后一次提交2019-01-06 14:47:43
发布数1
最新版本名称v1.0.0 (发布于 )
第一版名称v1.0.0 (发布于 )
用户参与
星数123
关注者数10
派生数19
提交数9
已启用问题?
问题数2
打开的问题数2
拉请求数1
打开的拉请求数0
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?