Search by

phobetor / rabbitmq-supervisor-bundle

Phobetor

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

Package info

github.com/Phobetor/rabbitmq-supervisor-bundle

Type:symfony-bundle

pkg:composer/phobetor/rabbitmq-supervisor-bundle

Statistics

Installs: 582 539

Dependents: 0

Suggesters: 0

Stars: 104

Open Issues: 5

4.0.1 2026-11-26 06:32 UTC

This package is auto-updated.

Last update: 2026-11-26 06:34:53 UTC


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

$ bin/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.

Requirements

  • PHP 7.1 or higher
  • Symfony 2.5 up to 8.x

Installation

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

# apt-get install supervisor

Add bundle via composer

$ composer require phobetor/rabbitmq-supervisor-bundle

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

If you are using Symfony Flex, the bundle is registered automatically. Otherwise register it yourself.

Symfony 4 to 8:

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

Symfony 2 & 3:

// app/AppKernel.php

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

The examples below use bin/console. On Symfony 2 use app/console instead.

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

$ bin/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.

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

PHP 7.1 or higher is required now. The commands and the extension declare native return types (configure(): void, execute(): int, load(): void, prepend(): void). If you extend one of these classes and override such a method, add the same return type to your method.

Usage

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

$ bin/console rabbitmq-supervisor:rebuild

Control the supervisord daemon:

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

To list all commands of this bundle run

$ bin/console list rabbitmq-supervisor