forked from php-amqplib/RabbitMqBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OldSoundRabbitMqBundle.php
36 lines (31 loc) · 1.07 KB
/
OldSoundRabbitMqBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace OldSound\RabbitMqBundle;
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\InjectEventDispatcherPass;
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\RegisterPartsPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class OldSoundRabbitMqBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new RegisterPartsPass());
$container->addCompilerPass(new InjectEventDispatcherPass());
}
/**
* {@inheritDoc}
*/
public function shutdown()
{
parent::shutdown();
if (!$this->container->hasParameter('old_sound_rabbit_mq.base_amqp')) {
return;
}
$connections = $this->container->getParameter('old_sound_rabbit_mq.base_amqp');
foreach ($connections as $connection) {
if ($this->container->initialized($connection)) {
$this->container->get($connection)->close();
}
}
}
}