GithubHelp home page GithubHelp logo

ronrademaker / rabbitmq-supervisor-bundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phobetor/rabbitmq-supervisor-bundle

0.0 1.0 0.0 44 KB

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

License: MIT License

PHP 93.68% HTML 6.32%

rabbitmq-supervisor-bundle's Introduction

RabbitMQ supervisor bundle

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 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

app/console rabbitmq-supervisor:rebuild

again and all the daemons will be updated.

Installation

Add bundle via command line

php composer.phar require phobetor/rabbitmq-supervisor-bundle

or manually to composer.json file

{
    "require": {
        "phobetor/rabbitmq-supervisor-bundle": "~1.3"
    }
}

Fetch the needed files:

$ php composer.phar update phobetor/rabbitmq-supervisor-bundle

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

Add the bundle to your project’s AppKernel:

<?php
// app/AppKernel.php

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

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:

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

Advanced configuration

All the paths and commands can be changed in app/config/config.yml:

rabbit_mq_supervisor:
    worker_count:                       1 # number of workers per queue
    supervisor_instance_identifier:     instance_name
    paths:
        workspace_directory:            /path/to/workspace/
        configuration_file:             /path/to/workspace/supervisord.conf
        pid_file:                       /path/to/workspace/supervisord.pid
        sock_file:                      /path/to/workspace/supervisord.sock
        log_file:                       /path/to/workspace/supervisord.log
        worker_configuration_directory: /path/to/workspace/worker/
        worker_output_log_file:         /path/to/workspace/logs/%kernel.environment%.log
        worker_error_log_file:          /path/to/workspace/logs/%kernel.environment%.log
    commands:
        rabbitmq_consumer:              user-specific-command:consumer -m %%1$d %%2$s
        rabbitmq_multiple_consumer:     user-specific-command:multiple-consumer -m %%1$d %%2$s

Usage

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

app/console rabbitmq-supervisor:rebuild

Control the supervisord daemon:

app/console rabbitmq-supervisor:control stop
app/console rabbitmq-supervisor:control start
app/console rabbitmq-supervisor:control restart
app/console rabbitmq-supervisor:control hup

rabbitmq-supervisor-bundle's People

Contributors

jjbubudi avatar phobetor avatar robholmes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.