prooph / service-bus-symfony-bundle

Symfony Bundle - PHP Lightweight Message Bus supporting CQRS
http://getprooph.org/
Other
89 stars 26 forks source link

Disable DataCollectorPlugin #66

Open enumag opened 6 years ago

enumag commented 6 years ago

For some reason the DataCollectorPlugin slows the performance of my import by roughly 100%. According to blackfire.io the plugin greatly increases time used by garbage collector. I don't care why that happens since I don't really need the plugin.

I obviously can't set kernel.debug to false since I want to see errors. And I can't uninstall symfony/stopwatch either since it is required by friendsofphp/php-cs-fixer. So I need some other way to disable this plugin. How can I do that?

enumag commented 6 years ago

For now I'm using this workaround but there should be some other way in my opinion.

services:
    prooph_service_bus.plugin.data_collector:
        class: App\Library\Prooph\Infrastructure\NullPlugin
<?php declare(strict_types = 1);

namespace App\Library\Prooph\Infrastructure;

use Prooph\ServiceBus\MessageBus;
use Prooph\ServiceBus\Plugin\Plugin;

class NullPlugin implements Plugin
{
    public function attachToMessageBus(MessageBus $messageBus): void
    {
    }

    public function detachFromMessageBus(MessageBus $messageBus): void
    {
    }
}