innmind/homeostasis-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

App health regulator bundle

2.0.0 2017-10-07 12:21 UTC

This package is auto-updated.

Last update: 2022-02-01 13:08:07 UTC


README

master develop
Scrutinizer Code Quality Scrutinizer Code Quality
Code Coverage Code Coverage
Build Status Build Status

Installation

composer require innmind/homeostasis-bundle

Enable the bundle by adding the following line in your app/AppKernel.php of your project:

// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Innmind\HomeostasisBundle\InnmindHomeostasisBundle,
        );
        // ...
    }
    // ...
}

Then you need to specify the an actuator:

innmind_homeostasis:
    actuator: service_id

The actuator service will need to implement the interface Innmind\Homeostasis\Actuator.

By default it uses the cpu and symfony logs as factors, but you can your own via the factors config key. To add a factor you need to create a service tagged with innmind.homeostasis.factor and with an alias attribute, this alias will need to be a key in the factors config. If you define a factory on your service then the data under your alias in the config will be injected in the factory service.

Usage

To trigger the whole mechanism you just have to call the following code somewhere in your app (for exemple on console.terminate when an amqp consumer finished his job).

$container->get('innmind.homeostasis.regulator')();