1 | <?php |
||
12 | class DtcQueueExtension extends Extension |
||
13 | { |
||
14 | 3 | public function load(array $configs, ContainerBuilder $container) |
|
36 | |||
37 | 3 | protected function configClasses(array $config, ContainerBuilder $container) |
|
46 | |||
47 | 3 | protected function configRabbitMQ(array $config, ContainerBuilder $container) |
|
48 | { |
||
49 | 3 | if (isset($config['rabbit_mq'])) { |
|
50 | 1 | foreach (['host', 'port', 'user', 'password'] as $value) { |
|
51 | 1 | if (!isset($config['rabbit_mq'][$value])) { |
|
52 | 1 | throw new InvalidConfigurationException('dtc_queue: rabbit_mq must have '.$value.' in config.yml'); |
|
53 | } |
||
54 | 1 | } |
|
55 | 1 | $config['rabbit_mq']['queue_args']['max_priority'] = $config['priority_max']; |
|
56 | 1 | $container->setParameter('dtc_queue.rabbit_mq', $config['rabbit_mq']); |
|
57 | 1 | } |
|
58 | 3 | } |
|
59 | |||
60 | 3 | protected function configBeanstalkd(array $config, ContainerBuilder $container) |
|
61 | { |
||
62 | 3 | if (isset($config['beanstalkd'])) { |
|
63 | 1 | if (!isset($config['beanstalkd']['host'])) { |
|
64 | 1 | throw new InvalidConfigurationException('dtc_queue: beanstalkd requires host in config.yml'); |
|
65 | } |
||
66 | 1 | } |
|
67 | |||
68 | 3 | if (isset($config['beanstalkd']['host'])) { |
|
69 | 1 | $container->setParameter('dtc_queue.beanstalkd.host', $config['beanstalkd']['host']); |
|
70 | 1 | } |
|
71 | 3 | if (isset($config['beanstalkd']['tube'])) { |
|
72 | 1 | $container->setParameter('dtc_queue.beanstalkd.tube', $config['beanstalkd']['tube']); |
|
73 | 1 | } |
|
74 | 3 | } |
|
75 | |||
76 | 1 | public function getAlias() |
|
80 | } |
||
81 |