2017 © Pedro Peláez
 

library worker-manager

RabbitMQ workers manager

image

artaxmax/worker-manager

RabbitMQ workers manager

  • Wednesday, August 10, 2016
  • by artaxmax
  • Repository
  • 1 Watchers
  • 1 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

worker-manager

Application check rabbitMQ queue message rate and supervisor worker status. If queue is empty - app will stop workers. Whet get new message - will start worker(s). In supervisor configuration need to be configured max count of workers., (*1)

Installation, (*2)

composer require artaxmax/worker-manager

Usage

Create console file (app/console.php):, (*3)

<?php

set_time_limit(0);

require_once __DIR__.'/../vendor/autoload.php'; // include composer autoload.php file

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use WorkerManager\Command\WorkerCommand;

$application = new Application();
$application->add(new WorkerCommand()); // add worker command
$application->run(new ArgvInput()); // run application

Create config YML file (config.yml), (*4)

  • Configure RabbitMQ api:, (*5)

    worker_manager:
        rabbitmq:
            rabbit1:
                name: rabbit1
                host: localhost
                username: username
                password: password
  • Configure supervisor:, (*6)

    worker_manager:
        supervisor1:
            name: supervisor1
            server: http://localhost:8081
            username: username
            password: password
            config: /.../supervisor.conf
            max_worker_count: 10
  • Configure each one worker:, (*7)

    worker_manager:
        worker1:
            name: worker1
            queue: worker1-queue
            vhost: /
            min_count: 1
            max_count: 2

Register config file, (*8)

<?php

use WorkerManager\Service\ConfigManager;

...

ConfigManager::register(__DIR__.'/config/config.yml');

Run application:, (*9)

php app/console.php worker-manager:start

You can add your own logging class. It should implement WorkerManager\Interfaces\LoggerInterface interface:, (*10)

<?php
    ...
    $logger = new YourLogger();
    $command = new WorkerCommand();
    $command->setLogger($logger);
    ...
    $application->add($command);
    ...

The Versions

10/08 2016

dev-master

9999999-dev

RabbitMQ workers manager

  Sources   Download

proprietary

The Requires

 

by Arturas Dmitrukas

19/07 2016

dev-control-panel

dev-control-panel

RabbitMQ workers manager

  Sources   Download

proprietary

The Requires

 

by Arturas Dmitrukas