phobetor/rabbitmq-supervisor-bundle 问题修复 & 功能扩展

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

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

phobetor/rabbitmq-supervisor-bundle

最新稳定版本:3.3.0

Composer 安装命令:

composer require phobetor/rabbitmq-supervisor-bundle

包简介

Symfony bundle to automatically create and update supervisor configurations for RabbitMQ consumer daemons

README 文档

README

Latest Stable Version License

Symfony bundle to automatically create and update supervisor configurations for php-amqplib/rabbitmq-bundle (and its predecessor oldsound/rabbitmq-bundle) RabbitMQ consumer daemons.

In a nutshell | tl;dr

If you use php-amqplib/rabbitmq-bundle to handle the communication with RabbitMQ, just install supervisor, add this bundle and run

$ app/console rabbitmq-supervisor:rebuild

to get a running supervisord instance that automatically manages all your consumer daemons. When your worker configuration or your code changes, run the command again and all the daemons will be updated.

Installation

Install supervisor. e. g. on debian based distributions via apt-get:

# apt-get install supervisor

Add bundle via composer

$ php composer require phobetor/rabbitmq-supervisor-bundle

This will install the bundle to your project’s vendor directory.

If your are not using Symfony Flex, also add the bundle to your project’s AppKernel:

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // […]
        new Phobetor\RabbitMqSupervisorBundle\RabbitMqSupervisorBundle(),
    ];
}

Symfony 5:

// config/bundles.php
return [
    ...
    Phobetor\RabbitMqSupervisorBundle\RabbitMqSupervisorBundle::class => ["all" => true],
    ...
];

Zero Configuration

RabbitMQ supervisor bundle works out of the box with a predefined configuration. If you leave it this way you will end up with this directory structure:

supervisor/
└── dev
    ├── logs
    │   ├── stderr.log
    │   └── stdout.log
    ├── supervisord.conf
    ├── supervisord.log
    ├── supervisor.pid
    ├── supervisor.sock
    └── worker
        ├── queue1.conf
        ├── queue2.conf
        ├── queue3.conf
        └── queue4.conf

If you want to use the standard structure inside of the var/ directory, change the configuration like this:

rabbit_mq_supervisor:
    paths:
        workspace_directory:            "%kernel.project_dir%/var/supervisor/%kernel.environment%/"
        configuration_file:             "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisord.conf"
        pid_file:                       "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisor.pid"
        sock_file:                      "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisor.sock"
        log_file:                       "%kernel.project_dir%/var/supervisor/%kernel.environment%/supervisord.log"
        worker_configuration_directory: "%kernel.project_dir%/var/supervisor/%kernel.environment%/worker/"
        worker_output_log_file:         "%kernel.project_dir%/var/supervisor/%kernel.environment%/logs/stdout.log"
        worker_error_log_file:          "%kernel.project_dir%/var/supervisor/%kernel.environment%/logs/stderr.log"

Advanced configuration

To see all configuration options run

$ console config:dump-reference RabbitMqSupervisorBundle

BC break when updating from v1.* to v2.*

If you used custom commands before version 2.0, you need to update them. In most case you can just remove everything after the command name.

BC break when updating from v2.* to v3.*

Commands will by default no longer wait for supervisord to complete. If you need this (e. g. to get feedback on errors) use the --wait-for-supervisord option.

Usage

Build or rebuild the supervisor and worker configuration and start the daemon:

$ console rabbitmq-supervisor:rebuild

Control the supervisord daemon:

$ console rabbitmq-supervisor:control stop
$ console rabbitmq-supervisor:control start
$ console rabbitmq-supervisor:control restart
$ console rabbitmq-supervisor:control hup

统计信息

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

GitHub 信息

  • Stars: 104
  • Watchers: 9
  • Forks: 44
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-28