eMAGTechLabs /
RabbitMqBundle
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace OldSound\RabbitMqBundle\DependencyInjection; |
||||
| 4 | |||||
| 5 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||
| 6 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||
| 7 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||||
| 8 | |||||
| 9 | /** |
||||
| 10 | * Configuration |
||||
| 11 | * |
||||
| 12 | * @author Marc Weistroff <[email protected]> |
||||
| 13 | */ |
||||
| 14 | class Configuration implements ConfigurationInterface |
||||
| 15 | { |
||||
| 16 | /** |
||||
| 17 | * @var string |
||||
| 18 | */ |
||||
| 19 | protected $name; |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * Configuration constructor. |
||||
| 23 | * |
||||
| 24 | * @param string $name |
||||
| 25 | */ |
||||
| 26 | 31 | public function __construct($name) |
|||
| 27 | { |
||||
| 28 | 31 | $this->name = $name; |
|||
| 29 | 31 | } |
|||
| 30 | |||||
| 31 | 31 | public function getConfigTreeBuilder() |
|||
| 32 | { |
||||
| 33 | 31 | $tree = new TreeBuilder($this->name); |
|||
| 34 | /** @var ArrayNodeDefinition $rootNode */ |
||||
| 35 | 31 | $rootNode = $tree->getRootNode(); |
|||
| 36 | |||||
| 37 | $rootNode |
||||
| 38 | 31 | ->children() |
|||
| 39 | 31 | ->booleanNode('debug')->defaultValue('%kernel.debug%')->end() |
|||
| 40 | 31 | ->booleanNode('enable_collector')->defaultValue(false)->end() |
|||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 41 | 31 | ->booleanNode('sandbox')->defaultValue(false)->end() |
|||
| 42 | 31 | ->end() |
|||
| 43 | ; |
||||
| 44 | |||||
| 45 | 31 | $this->addConnections($rootNode); |
|||
| 46 | 31 | $this->addBindings($rootNode); |
|||
| 47 | 31 | $this->addProducers($rootNode); |
|||
| 48 | 31 | $this->addConsumers($rootNode); |
|||
| 49 | 31 | $this->addMultipleConsumers($rootNode); |
|||
| 50 | 31 | $this->addDynamicConsumers($rootNode); |
|||
| 51 | 31 | $this->addBatchConsumers($rootNode); |
|||
| 52 | 31 | $this->addAnonConsumers($rootNode); |
|||
| 53 | 31 | $this->addRpcClients($rootNode); |
|||
| 54 | 31 | $this->addRpcServers($rootNode); |
|||
| 55 | |||||
| 56 | 31 | return $tree; |
|||
| 57 | } |
||||
| 58 | |||||
| 59 | 31 | protected function addConnections(ArrayNodeDefinition $node) |
|||
| 60 | { |
||||
| 61 | $node |
||||
| 62 | 31 | ->fixXmlConfig('connection') |
|||
| 63 | 31 | ->children() |
|||
| 64 | 31 | ->arrayNode('connections') |
|||
| 65 | 31 | ->useAttributeAsKey('key') |
|||
| 66 | 31 | ->canBeUnset() |
|||
| 67 | 31 | ->prototype('array') |
|||
| 68 | 31 | ->children() |
|||
| 69 | 31 | ->scalarNode('url')->defaultValue('')->end() |
|||
| 70 | 31 | ->scalarNode('host')->defaultValue('localhost')->end() |
|||
| 71 | 31 | ->scalarNode('port')->defaultValue(5672)->end() |
|||
| 72 | 31 | ->scalarNode('user')->defaultValue('guest')->end() |
|||
| 73 | 31 | ->scalarNode('password')->defaultValue('guest')->end() |
|||
| 74 | 31 | ->scalarNode('vhost')->defaultValue('/')->end() |
|||
| 75 | 31 | ->booleanNode('lazy')->defaultFalse()->end() |
|||
| 76 | 31 | ->scalarNode('connection_timeout')->defaultValue(3)->end() |
|||
| 77 | 31 | ->scalarNode('read_write_timeout')->defaultValue(3)->end() |
|||
| 78 | 31 | ->booleanNode('use_socket')->defaultValue(false)->end() |
|||
| 79 | 31 | ->arrayNode('ssl_context') |
|||
| 80 | 31 | ->useAttributeAsKey('key') |
|||
| 81 | 31 | ->canBeUnset() |
|||
| 82 | 31 | ->prototype('variable')->end() |
|||
| 83 | 31 | ->end() |
|||
| 84 | 31 | ->booleanNode('keepalive')->defaultFalse()->info('requires php-amqplib v2.4.1+ and PHP5.4+')->end() |
|||
| 85 | 31 | ->scalarNode('heartbeat')->defaultValue(0)->info('requires php-amqplib v2.4.1+')->end() |
|||
| 86 | 31 | ->scalarNode('connection_parameters_provider')->end() |
|||
| 87 | 31 | ->end() |
|||
| 88 | 31 | ->end() |
|||
| 89 | 31 | ->end() |
|||
| 90 | 31 | ->end() |
|||
| 91 | ; |
||||
| 92 | 31 | } |
|||
| 93 | |||||
| 94 | 31 | protected function addProducers(ArrayNodeDefinition $node) |
|||
| 95 | { |
||||
| 96 | $node |
||||
| 97 | 31 | ->fixXmlConfig('producer') |
|||
| 98 | 31 | ->children() |
|||
| 99 | 31 | ->arrayNode('producers') |
|||
| 100 | 31 | ->canBeUnset() |
|||
| 101 | 31 | ->useAttributeAsKey('key') |
|||
| 102 | 31 | ->prototype('array') |
|||
| 103 | 31 | ->append($this->getExchangeConfiguration()) |
|||
|
0 ignored issues
–
show
The method
append() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 104 | 31 | ->append($this->getQueueConfiguration()) |
|||
| 105 | 31 | ->children() |
|||
| 106 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 107 | 31 | ->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
|||
| 108 | 31 | ->scalarNode('class')->defaultValue('%old_sound_rabbit_mq.producer.class%')->end() |
|||
| 109 | 31 | ->scalarNode('enable_logger')->defaultFalse()->end() |
|||
| 110 | 31 | ->scalarNode('service_alias')->defaultValue(null)->end() |
|||
| 111 | 31 | ->end() |
|||
| 112 | 31 | ->end() |
|||
| 113 | 31 | ->end() |
|||
| 114 | 31 | ->end() |
|||
| 115 | ; |
||||
| 116 | 31 | } |
|||
| 117 | |||||
| 118 | 31 | protected function addBindings(ArrayNodeDefinition $node) |
|||
| 119 | { |
||||
| 120 | $node |
||||
| 121 | 31 | ->fixXmlConfig('binding') |
|||
| 122 | 31 | ->children() |
|||
| 123 | 31 | ->arrayNode('bindings') |
|||
| 124 | 31 | ->canBeUnset() |
|||
| 125 | 31 | ->prototype('array') |
|||
| 126 | 31 | ->children() |
|||
| 127 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 128 | 31 | ->scalarNode('exchange')->defaultNull()->end() |
|||
| 129 | 31 | ->scalarNode('destination')->defaultNull()->end() |
|||
| 130 | 31 | ->scalarNode('routing_key')->defaultNull()->end() |
|||
| 131 | 31 | ->booleanNode('nowait')->defaultFalse()->end() |
|||
| 132 | 31 | ->booleanNode('destination_is_exchange')->defaultFalse()->end() |
|||
| 133 | 31 | ->variableNode('arguments')->defaultNull()->end() |
|||
| 134 | 31 | ->scalarNode('class')->defaultValue('%old_sound_rabbit_mq.binding.class%')->end() |
|||
| 135 | 31 | ->end() |
|||
| 136 | 31 | ->end() |
|||
| 137 | 31 | ->end() |
|||
| 138 | 31 | ->end() |
|||
| 139 | ; |
||||
| 140 | 31 | } |
|||
| 141 | |||||
| 142 | 31 | protected function addConsumers(ArrayNodeDefinition $node) |
|||
| 143 | { |
||||
| 144 | $node |
||||
| 145 | 31 | ->fixXmlConfig('consumer') |
|||
| 146 | 31 | ->children() |
|||
| 147 | 31 | ->arrayNode('consumers') |
|||
| 148 | 31 | ->canBeUnset() |
|||
| 149 | 31 | ->useAttributeAsKey('key') |
|||
| 150 | 31 | ->prototype('array') |
|||
| 151 | 31 | ->append($this->getExchangeConfiguration()) |
|||
| 152 | 31 | ->append($this->getQueueConfiguration()) |
|||
| 153 | 31 | ->children() |
|||
| 154 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 155 | 31 | ->scalarNode('callback')->isRequired()->end() |
|||
| 156 | 31 | ->scalarNode('idle_timeout')->end() |
|||
| 157 | 31 | ->scalarNode('idle_timeout_exit_code')->end() |
|||
| 158 | 31 | ->scalarNode('timeout_wait')->end() |
|||
| 159 | 31 | ->arrayNode('graceful_max_execution') |
|||
| 160 | 31 | ->canBeUnset() |
|||
| 161 | 31 | ->children() |
|||
| 162 | 31 | ->integerNode('timeout')->end() |
|||
| 163 | 31 | ->integerNode('exit_code')->defaultValue(0)->end() |
|||
| 164 | 31 | ->end() |
|||
| 165 | 31 | ->end() |
|||
| 166 | 31 | ->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
|||
| 167 | 31 | ->arrayNode('qos_options') |
|||
| 168 | 31 | ->canBeUnset() |
|||
| 169 | 31 | ->children() |
|||
| 170 | 31 | ->scalarNode('prefetch_size')->defaultValue(0)->end() |
|||
| 171 | 31 | ->scalarNode('prefetch_count')->defaultValue(0)->end() |
|||
| 172 | 31 | ->booleanNode('global')->defaultFalse()->end() |
|||
| 173 | 31 | ->end() |
|||
| 174 | 31 | ->end() |
|||
| 175 | 31 | ->scalarNode('enable_logger')->defaultFalse()->end() |
|||
| 176 | 31 | ->end() |
|||
| 177 | 31 | ->end() |
|||
| 178 | 31 | ->end() |
|||
| 179 | 31 | ->end() |
|||
| 180 | ; |
||||
| 181 | 31 | } |
|||
| 182 | |||||
| 183 | 31 | protected function addMultipleConsumers(ArrayNodeDefinition $node) |
|||
| 184 | { |
||||
| 185 | $node |
||||
| 186 | 31 | ->fixXmlConfig('multiple_consumer') |
|||
| 187 | 31 | ->children() |
|||
| 188 | 31 | ->arrayNode('multiple_consumers') |
|||
| 189 | 31 | ->canBeUnset() |
|||
| 190 | 31 | ->useAttributeAsKey('key') |
|||
| 191 | 31 | ->prototype('array') |
|||
| 192 | 31 | ->append($this->getExchangeConfiguration()) |
|||
| 193 | 31 | ->children() |
|||
| 194 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 195 | 31 | ->scalarNode('idle_timeout')->end() |
|||
| 196 | 31 | ->scalarNode('idle_timeout_exit_code')->end() |
|||
| 197 | 31 | ->scalarNode('timeout_wait')->end() |
|||
| 198 | 31 | ->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
|||
| 199 | 31 | ->arrayNode('graceful_max_execution') |
|||
| 200 | 31 | ->canBeUnset() |
|||
| 201 | 31 | ->children() |
|||
| 202 | 31 | ->integerNode('timeout')->end() |
|||
| 203 | 31 | ->integerNode('exit_code')->defaultValue(0)->end() |
|||
| 204 | 31 | ->end() |
|||
| 205 | 31 | ->end() |
|||
| 206 | 31 | ->append($this->getMultipleQueuesConfiguration()) |
|||
| 207 | 31 | ->arrayNode('qos_options') |
|||
| 208 | 31 | ->canBeUnset() |
|||
| 209 | 31 | ->children() |
|||
| 210 | 31 | ->scalarNode('prefetch_size')->defaultValue(0)->end() |
|||
| 211 | 31 | ->scalarNode('prefetch_count')->defaultValue(0)->end() |
|||
| 212 | 31 | ->booleanNode('global')->defaultFalse()->end() |
|||
| 213 | 31 | ->end() |
|||
| 214 | 31 | ->end() |
|||
| 215 | 31 | ->scalarNode('queues_provider')->defaultNull()->end() |
|||
| 216 | 31 | ->scalarNode('enable_logger')->defaultFalse()->end() |
|||
| 217 | 31 | ->end() |
|||
| 218 | 31 | ->end() |
|||
| 219 | 31 | ->end() |
|||
| 220 | ; |
||||
| 221 | 31 | } |
|||
| 222 | |||||
| 223 | 31 | protected function addDynamicConsumers(ArrayNodeDefinition $node) |
|||
| 224 | { |
||||
| 225 | $node |
||||
| 226 | 31 | ->fixXmlConfig('dynamic_consumer') |
|||
| 227 | 31 | ->children() |
|||
| 228 | 31 | ->arrayNode('dynamic_consumers') |
|||
| 229 | 31 | ->canBeUnset() |
|||
| 230 | 31 | ->useAttributeAsKey('key') |
|||
| 231 | 31 | ->prototype('array') |
|||
| 232 | 31 | ->append($this->getExchangeConfiguration()) |
|||
| 233 | 31 | ->children() |
|||
| 234 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 235 | 31 | ->scalarNode('callback')->isRequired()->end() |
|||
| 236 | 31 | ->scalarNode('idle_timeout')->end() |
|||
| 237 | 31 | ->scalarNode('idle_timeout_exit_code')->end() |
|||
| 238 | 31 | ->scalarNode('timeout_wait')->end() |
|||
| 239 | 31 | ->arrayNode('graceful_max_execution') |
|||
| 240 | 31 | ->canBeUnset() |
|||
| 241 | 31 | ->children() |
|||
| 242 | 31 | ->integerNode('timeout')->end() |
|||
| 243 | 31 | ->integerNode('exit_code')->defaultValue(0)->end() |
|||
| 244 | 31 | ->end() |
|||
| 245 | 31 | ->end() |
|||
| 246 | 31 | ->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
|||
| 247 | 31 | ->arrayNode('qos_options') |
|||
| 248 | 31 | ->canBeUnset() |
|||
| 249 | 31 | ->children() |
|||
| 250 | 31 | ->scalarNode('prefetch_size')->defaultValue(0)->end() |
|||
| 251 | 31 | ->scalarNode('prefetch_count')->defaultValue(0)->end() |
|||
| 252 | 31 | ->booleanNode('global')->defaultFalse()->end() |
|||
| 253 | 31 | ->end() |
|||
| 254 | 31 | ->end() |
|||
| 255 | 31 | ->scalarNode('queue_options_provider')->isRequired()->end() |
|||
| 256 | 31 | ->scalarNode('enable_logger')->defaultFalse()->end() |
|||
| 257 | 31 | ->end() |
|||
| 258 | 31 | ->end() |
|||
| 259 | 31 | ->end() |
|||
| 260 | 31 | ->end() |
|||
| 261 | ; |
||||
| 262 | 31 | } |
|||
| 263 | |||||
| 264 | /** |
||||
| 265 | * @param ArrayNodeDefinition $node |
||||
| 266 | * |
||||
| 267 | * @return void |
||||
| 268 | */ |
||||
| 269 | 31 | protected function addBatchConsumers(ArrayNodeDefinition $node) |
|||
| 270 | { |
||||
| 271 | $node |
||||
| 272 | 31 | ->children() |
|||
| 273 | 31 | ->arrayNode('batch_consumers') |
|||
| 274 | 31 | ->canBeUnset() |
|||
| 275 | 31 | ->useAttributeAsKey('key') |
|||
| 276 | 31 | ->prototype('array') |
|||
| 277 | 31 | ->append($this->getExchangeConfiguration()) |
|||
| 278 | 31 | ->append($this->getQueueConfiguration()) |
|||
| 279 | 31 | ->children() |
|||
| 280 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 281 | 31 | ->scalarNode('callback')->isRequired()->end() |
|||
| 282 | 31 | ->scalarNode('idle_timeout')->end() |
|||
| 283 | 31 | ->scalarNode('timeout_wait')->defaultValue(3)->end() |
|||
| 284 | 31 | ->scalarNode('idle_timeout_exit_code')->end() |
|||
| 285 | 31 | ->scalarNode('keep_alive')->defaultFalse()->end() |
|||
| 286 | 31 | ->arrayNode('graceful_max_execution') |
|||
| 287 | 31 | ->canBeUnset() |
|||
| 288 | 31 | ->children() |
|||
| 289 | 31 | ->integerNode('timeout')->end() |
|||
| 290 | 31 | ->end() |
|||
| 291 | 31 | ->end() |
|||
| 292 | 31 | ->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
|||
| 293 | 31 | ->arrayNode('qos_options') |
|||
| 294 | 31 | ->children() |
|||
| 295 | 31 | ->scalarNode('prefetch_size')->defaultValue(0)->end() |
|||
| 296 | 31 | ->scalarNode('prefetch_count')->defaultValue(2)->end() |
|||
| 297 | 31 | ->booleanNode('global')->defaultFalse()->end() |
|||
| 298 | 31 | ->end() |
|||
| 299 | 31 | ->end() |
|||
| 300 | 31 | ->scalarNode('enable_logger')->defaultFalse()->end() |
|||
| 301 | 31 | ->end() |
|||
| 302 | 31 | ->end() |
|||
| 303 | 31 | ->end() |
|||
| 304 | 31 | ->end() |
|||
| 305 | ; |
||||
| 306 | 31 | } |
|||
| 307 | |||||
| 308 | 31 | protected function addAnonConsumers(ArrayNodeDefinition $node) |
|||
| 309 | { |
||||
| 310 | $node |
||||
| 311 | 31 | ->fixXmlConfig('anon_consumer') |
|||
| 312 | 31 | ->children() |
|||
| 313 | 31 | ->arrayNode('anon_consumers') |
|||
| 314 | 31 | ->canBeUnset() |
|||
| 315 | 31 | ->useAttributeAsKey('key') |
|||
| 316 | 31 | ->prototype('array') |
|||
| 317 | 31 | ->append($this->getExchangeConfiguration()) |
|||
| 318 | 31 | ->children() |
|||
| 319 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 320 | 31 | ->scalarNode('callback')->isRequired()->end() |
|||
| 321 | 31 | ->end() |
|||
| 322 | 31 | ->end() |
|||
| 323 | 31 | ->end() |
|||
| 324 | 31 | ->end() |
|||
| 325 | ; |
||||
| 326 | 31 | } |
|||
| 327 | |||||
| 328 | 31 | protected function addRpcClients(ArrayNodeDefinition $node) |
|||
| 329 | { |
||||
| 330 | $node |
||||
| 331 | 31 | ->fixXmlConfig('rpc_client') |
|||
| 332 | 31 | ->children() |
|||
| 333 | 31 | ->arrayNode('rpc_clients') |
|||
| 334 | 31 | ->canBeUnset() |
|||
| 335 | 31 | ->useAttributeAsKey('key') |
|||
| 336 | 31 | ->prototype('array') |
|||
| 337 | 31 | ->children() |
|||
| 338 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 339 | 31 | ->booleanNode('expect_serialized_response')->defaultTrue()->end() |
|||
| 340 | 31 | ->scalarNode('unserializer')->defaultValue('unserialize')->end() |
|||
| 341 | 31 | ->booleanNode('lazy')->defaultFalse()->end() |
|||
| 342 | 31 | ->booleanNode('direct_reply_to')->defaultFalse()->end() |
|||
| 343 | 31 | ->end() |
|||
| 344 | 31 | ->end() |
|||
| 345 | 31 | ->end() |
|||
| 346 | 31 | ->end() |
|||
| 347 | ; |
||||
| 348 | 31 | } |
|||
| 349 | |||||
| 350 | 31 | protected function addRpcServers(ArrayNodeDefinition $node) |
|||
| 351 | { |
||||
| 352 | $node |
||||
| 353 | 31 | ->fixXmlConfig('rpc_server') |
|||
| 354 | 31 | ->children() |
|||
| 355 | 31 | ->arrayNode('rpc_servers') |
|||
| 356 | 31 | ->canBeUnset() |
|||
| 357 | 31 | ->useAttributeAsKey('key') |
|||
| 358 | 31 | ->prototype('array') |
|||
| 359 | 31 | ->append($this->getExchangeConfiguration()) |
|||
| 360 | 31 | ->append($this->getQueueConfiguration()) |
|||
| 361 | 31 | ->children() |
|||
| 362 | 31 | ->scalarNode('connection')->defaultValue('default')->end() |
|||
| 363 | 31 | ->scalarNode('callback')->isRequired()->end() |
|||
| 364 | 31 | ->arrayNode('qos_options') |
|||
| 365 | 31 | ->canBeUnset() |
|||
| 366 | 31 | ->children() |
|||
| 367 | 31 | ->scalarNode('prefetch_size')->defaultValue(0)->end() |
|||
| 368 | 31 | ->scalarNode('prefetch_count')->defaultValue(0)->end() |
|||
| 369 | 31 | ->booleanNode('global')->defaultFalse()->end() |
|||
| 370 | 31 | ->end() |
|||
| 371 | 31 | ->end() |
|||
| 372 | 31 | ->scalarNode('serializer')->defaultValue('serialize')->end() |
|||
| 373 | 31 | ->scalarNode('enable_logger')->defaultFalse()->end() |
|||
| 374 | 31 | ->end() |
|||
| 375 | 31 | ->end() |
|||
| 376 | 31 | ->end() |
|||
| 377 | 31 | ->end() |
|||
| 378 | ; |
||||
| 379 | 31 | } |
|||
| 380 | |||||
| 381 | 31 | protected function getExchangeConfiguration() |
|||
| 382 | { |
||||
| 383 | 31 | $node = new ArrayNodeDefinition('exchange_options'); |
|||
| 384 | |||||
| 385 | return $node |
||||
| 386 | 31 | ->children() |
|||
| 387 | 31 | ->scalarNode('name')->isRequired()->end() |
|||
| 388 | 31 | ->scalarNode('type')->isRequired()->end() |
|||
|
0 ignored issues
–
show
The method
scalarNode() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 389 | 31 | ->booleanNode('passive')->defaultValue(false)->end() |
|||
| 390 | 31 | ->booleanNode('durable')->defaultValue(true)->end() |
|||
| 391 | 31 | ->booleanNode('auto_delete')->defaultValue(false)->end() |
|||
| 392 | 31 | ->booleanNode('internal')->defaultValue(false)->end() |
|||
| 393 | 31 | ->booleanNode('nowait')->defaultValue(false)->end() |
|||
| 394 | 31 | ->booleanNode('declare')->defaultValue(true)->end() |
|||
| 395 | 31 | ->variableNode('arguments')->defaultNull()->end() |
|||
| 396 | 31 | ->scalarNode('ticket')->defaultNull()->end() |
|||
| 397 | 31 | ->end() |
|||
| 398 | ; |
||||
| 399 | } |
||||
| 400 | |||||
| 401 | 31 | protected function getQueueConfiguration() |
|||
| 402 | { |
||||
| 403 | 31 | $node = new ArrayNodeDefinition('queue_options'); |
|||
| 404 | |||||
| 405 | 31 | $this->addQueueNodeConfiguration($node); |
|||
| 406 | |||||
| 407 | 31 | return $node; |
|||
| 408 | } |
||||
| 409 | |||||
| 410 | 31 | protected function getMultipleQueuesConfiguration() |
|||
| 411 | { |
||||
| 412 | 31 | $node = new ArrayNodeDefinition('queues'); |
|||
| 413 | 31 | $prototypeNode = $node->prototype('array'); |
|||
| 414 | |||||
| 415 | 31 | $this->addQueueNodeConfiguration($prototypeNode); |
|||
| 416 | |||||
| 417 | 31 | $prototypeNode->children() |
|||
| 418 | 31 | ->scalarNode('callback')->isRequired()->end() |
|||
| 419 | 31 | ->end(); |
|||
| 420 | |||||
| 421 | 31 | $prototypeNode->end(); |
|||
| 422 | |||||
| 423 | 31 | return $node; |
|||
| 424 | } |
||||
| 425 | |||||
| 426 | 31 | protected function addQueueNodeConfiguration(ArrayNodeDefinition $node) |
|||
| 427 | { |
||||
| 428 | $node |
||||
| 429 | 31 | ->fixXmlConfig('routing_key') |
|||
| 430 | 31 | ->children() |
|||
| 431 | 31 | ->scalarNode('name')->end() |
|||
| 432 | 31 | ->booleanNode('passive')->defaultFalse()->end() |
|||
| 433 | 31 | ->booleanNode('durable')->defaultTrue()->end() |
|||
| 434 | 31 | ->booleanNode('exclusive')->defaultFalse()->end() |
|||
| 435 | 31 | ->booleanNode('auto_delete')->defaultFalse()->end() |
|||
| 436 | 31 | ->booleanNode('nowait')->defaultFalse()->end() |
|||
| 437 | 31 | ->booleanNode('declare')->defaultTrue()->end() |
|||
| 438 | 31 | ->variableNode('arguments')->defaultNull()->end() |
|||
| 439 | 31 | ->scalarNode('ticket')->defaultNull()->end() |
|||
| 440 | 31 | ->arrayNode('routing_keys') |
|||
| 441 | 31 | ->prototype('scalar')->end() |
|||
| 442 | 31 | ->defaultValue(array()) |
|||
| 443 | 31 | ->end() |
|||
| 444 | 31 | ->end() |
|||
| 445 | ; |
||||
| 446 | 31 | } |
|||
| 447 | } |
||||
| 448 |