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() |
|
|
|
|
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->addGroupConsumers($rootNode); |
53
|
31 |
|
$this->addAnonConsumers($rootNode); |
54
|
31 |
|
$this->addRpcClients($rootNode); |
55
|
|
|
$this->addRpcServers($rootNode); |
56
|
31 |
|
|
57
|
|
|
return $tree; |
58
|
|
|
} |
59
|
31 |
|
|
60
|
|
|
protected function addConnections(ArrayNodeDefinition $node) |
61
|
|
|
{ |
62
|
31 |
|
$node |
63
|
31 |
|
->fixXmlConfig('connection') |
64
|
31 |
|
->children() |
65
|
31 |
|
->arrayNode('connections') |
66
|
31 |
|
->useAttributeAsKey('key') |
67
|
31 |
|
->canBeUnset() |
68
|
31 |
|
->prototype('array') |
69
|
31 |
|
->children() |
70
|
31 |
|
->scalarNode('url')->defaultValue('')->end() |
71
|
31 |
|
->scalarNode('host')->defaultValue('localhost')->end() |
72
|
31 |
|
->scalarNode('port')->defaultValue(5672)->end() |
73
|
31 |
|
->scalarNode('user')->defaultValue('guest')->end() |
74
|
31 |
|
->scalarNode('password')->defaultValue('guest')->end() |
75
|
31 |
|
->scalarNode('vhost')->defaultValue('/')->end() |
76
|
31 |
|
->booleanNode('lazy')->defaultFalse()->end() |
77
|
31 |
|
->scalarNode('connection_timeout')->defaultValue(3)->end() |
78
|
31 |
|
->scalarNode('read_write_timeout')->defaultValue(3)->end() |
79
|
31 |
|
->booleanNode('use_socket')->defaultValue(false)->end() |
80
|
31 |
|
->arrayNode('ssl_context') |
81
|
31 |
|
->useAttributeAsKey('key') |
82
|
31 |
|
->canBeUnset() |
83
|
31 |
|
->prototype('variable')->end() |
84
|
31 |
|
->end() |
85
|
31 |
|
->booleanNode('keepalive')->defaultFalse()->info('requires php-amqplib v2.4.1+ and PHP5.4+')->end() |
86
|
31 |
|
->scalarNode('heartbeat')->defaultValue(0)->info('requires php-amqplib v2.4.1+')->end() |
87
|
31 |
|
->scalarNode('connection_parameters_provider')->end() |
88
|
31 |
|
->end() |
89
|
31 |
|
->end() |
90
|
31 |
|
->end() |
91
|
|
|
->end() |
92
|
31 |
|
; |
93
|
|
|
} |
94
|
31 |
|
|
95
|
|
|
protected function addProducers(ArrayNodeDefinition $node) |
96
|
|
|
{ |
97
|
31 |
|
$node |
98
|
31 |
|
->fixXmlConfig('producer') |
99
|
31 |
|
->children() |
100
|
31 |
|
->arrayNode('producers') |
101
|
31 |
|
->canBeUnset() |
102
|
31 |
|
->useAttributeAsKey('key') |
103
|
31 |
|
->prototype('array') |
104
|
31 |
|
->append($this->getExchangeConfiguration()) |
|
|
|
|
105
|
31 |
|
->append($this->getQueueConfiguration()) |
106
|
31 |
|
->children() |
107
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
108
|
31 |
|
->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
109
|
31 |
|
->scalarNode('class')->defaultValue('%old_sound_rabbit_mq.producer.class%')->end() |
110
|
31 |
|
->scalarNode('enable_logger')->defaultFalse()->end() |
111
|
31 |
|
->scalarNode('service_alias')->defaultValue(null)->end() |
112
|
31 |
|
->end() |
113
|
31 |
|
->end() |
114
|
31 |
|
->end() |
115
|
|
|
->end() |
116
|
31 |
|
; |
117
|
|
|
} |
118
|
31 |
|
|
119
|
|
|
protected function addBindings(ArrayNodeDefinition $node) |
120
|
|
|
{ |
121
|
31 |
|
$node |
122
|
31 |
|
->fixXmlConfig('binding') |
123
|
31 |
|
->children() |
124
|
31 |
|
->arrayNode('bindings') |
125
|
31 |
|
->canBeUnset() |
126
|
31 |
|
->prototype('array') |
127
|
31 |
|
->children() |
128
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
129
|
31 |
|
->scalarNode('exchange')->defaultNull()->end() |
130
|
31 |
|
->scalarNode('destination')->defaultNull()->end() |
131
|
31 |
|
->scalarNode('routing_key')->defaultNull()->end() |
132
|
31 |
|
->booleanNode('nowait')->defaultFalse()->end() |
133
|
31 |
|
->booleanNode('destination_is_exchange')->defaultFalse()->end() |
134
|
31 |
|
->variableNode('arguments')->defaultNull()->end() |
135
|
31 |
|
->scalarNode('class')->defaultValue('%old_sound_rabbit_mq.binding.class%')->end() |
136
|
31 |
|
->end() |
137
|
31 |
|
->end() |
138
|
31 |
|
->end() |
139
|
|
|
->end() |
140
|
31 |
|
; |
141
|
|
|
} |
142
|
31 |
|
|
143
|
|
|
protected function addConsumers(ArrayNodeDefinition $node) |
144
|
|
|
{ |
145
|
31 |
|
$node |
146
|
31 |
|
->fixXmlConfig('consumer') |
147
|
31 |
|
->children() |
148
|
31 |
|
->arrayNode('consumers') |
149
|
31 |
|
->canBeUnset() |
150
|
31 |
|
->useAttributeAsKey('key') |
151
|
31 |
|
->prototype('array') |
152
|
31 |
|
->append($this->getExchangeConfiguration()) |
153
|
31 |
|
->append($this->getQueueConfiguration()) |
154
|
31 |
|
->children() |
155
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
156
|
31 |
|
->arrayNode('groups')->defaultValue(array('default')) |
157
|
31 |
|
->prototype('scalar') |
158
|
31 |
|
->end() |
159
|
31 |
|
->end() |
160
|
31 |
|
->scalarNode('callback')->isRequired()->end() |
161
|
31 |
|
->scalarNode('idle_timeout')->end() |
162
|
31 |
|
->scalarNode('idle_timeout_exit_code')->end() |
163
|
31 |
|
->scalarNode('timeout_wait')->end() |
164
|
31 |
|
->arrayNode('graceful_max_execution') |
165
|
31 |
|
->canBeUnset() |
166
|
31 |
|
->children() |
167
|
31 |
|
->integerNode('timeout')->end() |
168
|
31 |
|
->integerNode('exit_code')->defaultValue(0)->end() |
169
|
31 |
|
->end() |
170
|
31 |
|
->end() |
171
|
31 |
|
->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
172
|
31 |
|
->arrayNode('qos_options') |
173
|
31 |
|
->canBeUnset() |
174
|
31 |
|
->children() |
175
|
31 |
|
->scalarNode('prefetch_size')->defaultValue(0)->end() |
176
|
31 |
|
->scalarNode('prefetch_count')->defaultValue(0)->end() |
177
|
31 |
|
->booleanNode('global')->defaultFalse()->end() |
178
|
31 |
|
->end() |
179
|
31 |
|
->end() |
180
|
|
|
->scalarNode('enable_logger')->defaultFalse()->end() |
181
|
31 |
|
->end() |
182
|
|
|
->end() |
183
|
31 |
|
->end() |
184
|
|
|
->end() |
185
|
|
|
; |
186
|
31 |
|
} |
187
|
31 |
|
|
188
|
31 |
|
protected function addMultipleConsumers(ArrayNodeDefinition $node) |
189
|
31 |
|
{ |
190
|
31 |
|
$node |
191
|
31 |
|
->fixXmlConfig('multiple_consumer') |
192
|
31 |
|
->children() |
193
|
31 |
|
->arrayNode('multiple_consumers') |
194
|
31 |
|
->canBeUnset() |
195
|
31 |
|
->useAttributeAsKey('key') |
196
|
31 |
|
->prototype('array') |
197
|
31 |
|
->append($this->getExchangeConfiguration()) |
198
|
31 |
|
->children() |
199
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
200
|
31 |
|
->arrayNode('groups')->defaultValue(array('default')) |
201
|
31 |
|
->prototype('scalar') |
202
|
31 |
|
->end() |
203
|
31 |
|
->end() |
204
|
31 |
|
->scalarNode('idle_timeout')->end() |
205
|
31 |
|
->scalarNode('idle_timeout_exit_code')->end() |
206
|
31 |
|
->scalarNode('timeout_wait')->end() |
207
|
31 |
|
->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
208
|
31 |
|
->arrayNode('graceful_max_execution') |
209
|
31 |
|
->canBeUnset() |
210
|
31 |
|
->children() |
211
|
31 |
|
->integerNode('timeout')->end() |
212
|
31 |
|
->integerNode('exit_code')->defaultValue(0)->end() |
213
|
31 |
|
->end() |
214
|
31 |
|
->end() |
215
|
31 |
|
->append($this->getMultipleQueuesConfiguration()) |
216
|
31 |
|
->arrayNode('qos_options') |
217
|
31 |
|
->canBeUnset() |
218
|
31 |
|
->children() |
219
|
31 |
|
->scalarNode('prefetch_size')->defaultValue(0)->end() |
220
|
|
|
->scalarNode('prefetch_count')->defaultValue(0)->end() |
221
|
31 |
|
->booleanNode('global')->defaultFalse()->end() |
222
|
|
|
->end() |
223
|
31 |
|
->end() |
224
|
|
|
->scalarNode('queues_provider')->defaultNull()->end() |
225
|
|
|
->scalarNode('enable_logger')->defaultFalse()->end() |
226
|
31 |
|
->end() |
227
|
31 |
|
->end() |
228
|
31 |
|
->end() |
229
|
31 |
|
; |
230
|
31 |
|
} |
231
|
31 |
|
|
232
|
31 |
|
protected function addDynamicConsumers(ArrayNodeDefinition $node) |
233
|
31 |
|
{ |
234
|
31 |
|
$node |
235
|
31 |
|
->fixXmlConfig('dynamic_consumer') |
236
|
31 |
|
->children() |
237
|
31 |
|
->arrayNode('dynamic_consumers') |
238
|
31 |
|
->canBeUnset() |
239
|
31 |
|
->useAttributeAsKey('key') |
240
|
31 |
|
->prototype('array') |
241
|
31 |
|
->append($this->getExchangeConfiguration()) |
242
|
31 |
|
->children() |
243
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
244
|
31 |
|
->arrayNode('groups')->defaultValue(array('default')) |
245
|
31 |
|
->prototype('scalar') |
246
|
31 |
|
->end() |
247
|
31 |
|
->end() |
248
|
31 |
|
->scalarNode('callback')->isRequired()->end() |
249
|
31 |
|
->scalarNode('idle_timeout')->end() |
250
|
31 |
|
->scalarNode('idle_timeout_exit_code')->end() |
251
|
31 |
|
->scalarNode('timeout_wait')->end() |
252
|
31 |
|
->arrayNode('graceful_max_execution') |
253
|
31 |
|
->canBeUnset() |
254
|
31 |
|
->children() |
255
|
31 |
|
->integerNode('timeout')->end() |
256
|
31 |
|
->integerNode('exit_code')->defaultValue(0)->end() |
257
|
31 |
|
->end() |
258
|
31 |
|
->end() |
259
|
31 |
|
->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
260
|
31 |
|
->arrayNode('qos_options') |
261
|
|
|
->canBeUnset() |
262
|
31 |
|
->children() |
263
|
|
|
->scalarNode('prefetch_size')->defaultValue(0)->end() |
264
|
|
|
->scalarNode('prefetch_count')->defaultValue(0)->end() |
265
|
|
|
->booleanNode('global')->defaultFalse()->end() |
266
|
|
|
->end() |
267
|
|
|
->end() |
268
|
|
|
->scalarNode('queue_options_provider')->isRequired()->end() |
269
|
31 |
|
->scalarNode('enable_logger')->defaultFalse()->end() |
270
|
|
|
->end() |
271
|
|
|
->end() |
272
|
31 |
|
->end() |
273
|
31 |
|
->end() |
274
|
31 |
|
; |
275
|
31 |
|
} |
276
|
31 |
|
|
277
|
31 |
|
/** |
278
|
31 |
|
* @param ArrayNodeDefinition $node |
279
|
31 |
|
* |
280
|
31 |
|
* @return void |
281
|
31 |
|
*/ |
282
|
31 |
|
protected function addBatchConsumers(ArrayNodeDefinition $node) |
283
|
31 |
|
{ |
284
|
31 |
|
$node |
285
|
31 |
|
->children() |
286
|
31 |
|
->arrayNode('batch_consumers') |
287
|
31 |
|
->canBeUnset() |
288
|
31 |
|
->useAttributeAsKey('key') |
289
|
31 |
|
->prototype('array') |
290
|
31 |
|
->append($this->getExchangeConfiguration()) |
291
|
31 |
|
->append($this->getQueueConfiguration()) |
292
|
31 |
|
->children() |
293
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
294
|
31 |
|
->arrayNode('groups')->defaultValue(array('default')) |
295
|
31 |
|
->prototype('scalar') |
296
|
31 |
|
->end() |
297
|
31 |
|
->end() |
298
|
31 |
|
->scalarNode('callback')->isRequired()->end() |
299
|
31 |
|
->scalarNode('idle_timeout')->end() |
300
|
31 |
|
->scalarNode('timeout_wait')->defaultValue(3)->end() |
301
|
31 |
|
->scalarNode('idle_timeout_exit_code')->end() |
302
|
31 |
|
->scalarNode('keep_alive')->defaultFalse()->end() |
303
|
31 |
|
->arrayNode('graceful_max_execution') |
304
|
31 |
|
->canBeUnset() |
305
|
|
|
->children() |
306
|
31 |
|
->integerNode('timeout')->end() |
307
|
|
|
->end() |
308
|
31 |
|
->end() |
309
|
|
|
->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
310
|
|
|
->arrayNode('qos_options') |
311
|
31 |
|
->children() |
312
|
31 |
|
->scalarNode('prefetch_size')->defaultValue(0)->end() |
313
|
31 |
|
->scalarNode('prefetch_count')->defaultValue(2)->end() |
314
|
31 |
|
->booleanNode('global')->defaultFalse()->end() |
315
|
31 |
|
->end() |
316
|
31 |
|
->end() |
317
|
31 |
|
->scalarNode('enable_logger')->defaultFalse()->end() |
318
|
31 |
|
->end() |
319
|
31 |
|
->end() |
320
|
31 |
|
->end() |
321
|
31 |
|
->end() |
322
|
31 |
|
; |
323
|
31 |
|
} |
324
|
31 |
|
|
325
|
|
|
protected function addGroupConsumers(ArrayNodeDefinition $node) |
326
|
31 |
|
{ |
327
|
|
|
$node |
328
|
31 |
|
->children() |
329
|
|
|
->arrayNode('group_consumers') |
330
|
|
|
->canBeUnset() |
331
|
31 |
|
->useAttributeAsKey('key') |
332
|
31 |
|
->prototype('array') |
333
|
31 |
|
->children() |
334
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
335
|
31 |
|
->scalarNode('idle_timeout')->end() |
336
|
31 |
|
->scalarNode('idle_timeout_exit_code')->end() |
337
|
31 |
|
->scalarNode('timeout_wait')->end() |
338
|
31 |
|
->arrayNode('graceful_max_execution') |
339
|
31 |
|
->canBeUnset() |
340
|
31 |
|
->children() |
341
|
31 |
|
->integerNode('timeout')->end() |
342
|
31 |
|
->integerNode('exit_code')->defaultValue(0)->end() |
343
|
31 |
|
->end() |
344
|
31 |
|
->end() |
345
|
31 |
|
->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
346
|
31 |
|
->arrayNode('qos_options') |
347
|
|
|
->canBeUnset() |
348
|
31 |
|
->children() |
349
|
|
|
->scalarNode('prefetch_size')->defaultValue(0)->end() |
350
|
31 |
|
->scalarNode('prefetch_count')->defaultValue(0)->end() |
351
|
|
|
->booleanNode('global')->defaultFalse()->end() |
352
|
|
|
->end() |
353
|
31 |
|
->end() |
354
|
31 |
|
->scalarNode('enable_logger')->defaultFalse()->end() |
355
|
31 |
|
->end() |
356
|
31 |
|
->end(); |
357
|
31 |
|
} |
358
|
31 |
|
|
359
|
31 |
|
protected function addAnonConsumers(ArrayNodeDefinition $node) |
360
|
31 |
|
{ |
361
|
31 |
|
$node |
362
|
31 |
|
->fixXmlConfig('anon_consumer') |
363
|
31 |
|
->children() |
364
|
31 |
|
->arrayNode('anon_consumers') |
365
|
31 |
|
->canBeUnset() |
366
|
31 |
|
->useAttributeAsKey('key') |
367
|
31 |
|
->prototype('array') |
368
|
31 |
|
->append($this->getExchangeConfiguration()) |
369
|
31 |
|
->children() |
370
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
371
|
31 |
|
->arrayNode('groups')->defaultValue(array('default')) |
372
|
31 |
|
->prototype('scalar') |
373
|
31 |
|
->end() |
374
|
31 |
|
->end() |
375
|
31 |
|
->scalarNode('callback')->isRequired()->end() |
376
|
31 |
|
->end() |
377
|
31 |
|
->end() |
378
|
|
|
->end() |
379
|
31 |
|
->end() |
380
|
|
|
; |
381
|
31 |
|
} |
382
|
|
|
|
383
|
31 |
|
protected function addRpcClients(ArrayNodeDefinition $node) |
384
|
|
|
{ |
385
|
|
|
$node |
386
|
31 |
|
->fixXmlConfig('rpc_client') |
387
|
31 |
|
->children() |
388
|
31 |
|
->arrayNode('rpc_clients') |
389
|
31 |
|
->canBeUnset() |
390
|
31 |
|
->useAttributeAsKey('key') |
391
|
31 |
|
->prototype('array') |
392
|
31 |
|
->children() |
393
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
394
|
31 |
|
->booleanNode('expect_serialized_response')->defaultTrue()->end() |
395
|
31 |
|
->scalarNode('unserializer')->defaultValue('unserialize')->end() |
396
|
31 |
|
->booleanNode('lazy')->defaultFalse()->end() |
397
|
31 |
|
->booleanNode('direct_reply_to')->defaultFalse()->end() |
398
|
|
|
->end() |
399
|
|
|
->end() |
400
|
|
|
->end() |
401
|
31 |
|
->end() |
402
|
|
|
; |
403
|
31 |
|
} |
404
|
|
|
|
405
|
31 |
|
protected function addRpcServers(ArrayNodeDefinition $node) |
406
|
|
|
{ |
407
|
31 |
|
$node |
408
|
|
|
->fixXmlConfig('rpc_server') |
409
|
|
|
->children() |
410
|
31 |
|
->arrayNode('rpc_servers') |
411
|
|
|
->canBeUnset() |
412
|
31 |
|
->useAttributeAsKey('key') |
413
|
31 |
|
->prototype('array') |
414
|
|
|
->append($this->getExchangeConfiguration()) |
415
|
31 |
|
->append($this->getQueueConfiguration()) |
416
|
|
|
->children() |
417
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
418
|
31 |
|
->scalarNode('callback')->isRequired()->end() |
419
|
31 |
|
->arrayNode('qos_options') |
420
|
|
|
->canBeUnset() |
421
|
31 |
|
->children() |
422
|
|
|
->scalarNode('prefetch_size')->defaultValue(0)->end() |
423
|
31 |
|
->scalarNode('prefetch_count')->defaultValue(0)->end() |
424
|
|
|
->booleanNode('global')->defaultFalse()->end() |
425
|
|
|
->end() |
426
|
31 |
|
->end() |
427
|
|
|
->scalarNode('serializer')->defaultValue('serialize')->end() |
428
|
|
|
->scalarNode('enable_logger')->defaultFalse()->end() |
429
|
31 |
|
->end() |
430
|
31 |
|
->end() |
431
|
31 |
|
->end() |
432
|
31 |
|
->end() |
433
|
31 |
|
; |
434
|
31 |
|
} |
435
|
31 |
|
|
436
|
31 |
|
protected function getExchangeConfiguration() |
437
|
31 |
|
{ |
438
|
31 |
|
$node = new ArrayNodeDefinition('exchange_options'); |
439
|
31 |
|
|
440
|
31 |
|
return $node |
441
|
31 |
|
->children() |
442
|
31 |
|
->scalarNode('name')->isRequired()->end() |
443
|
31 |
|
->scalarNode('type')->isRequired()->end() |
|
|
|
|
444
|
31 |
|
->booleanNode('passive')->defaultValue(false)->end() |
445
|
|
|
->booleanNode('durable')->defaultValue(true)->end() |
446
|
31 |
|
->booleanNode('auto_delete')->defaultValue(false)->end() |
447
|
|
|
->booleanNode('internal')->defaultValue(false)->end() |
448
|
|
|
->booleanNode('nowait')->defaultValue(false)->end() |
449
|
|
|
->booleanNode('declare')->defaultValue(true)->end() |
450
|
|
|
->variableNode('arguments')->defaultNull()->end() |
451
|
|
|
->scalarNode('ticket')->defaultNull()->end() |
452
|
|
|
->end() |
453
|
|
|
; |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
protected function getQueueConfiguration() |
457
|
|
|
{ |
458
|
|
|
$node = new ArrayNodeDefinition('queue_options'); |
459
|
|
|
|
460
|
|
|
$this->addQueueNodeConfiguration($node); |
461
|
|
|
|
462
|
|
|
return $node; |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
protected function getMultipleQueuesConfiguration() |
466
|
|
|
{ |
467
|
|
|
$node = new ArrayNodeDefinition('queues'); |
468
|
|
|
$prototypeNode = $node->prototype('array'); |
469
|
|
|
|
470
|
|
|
$this->addQueueNodeConfiguration($prototypeNode); |
471
|
|
|
|
472
|
|
|
$prototypeNode->children() |
473
|
|
|
->scalarNode('callback')->isRequired()->end() |
474
|
|
|
->end(); |
475
|
|
|
|
476
|
|
|
$prototypeNode->end(); |
477
|
|
|
|
478
|
|
|
return $node; |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
protected function addQueueNodeConfiguration(ArrayNodeDefinition $node) |
482
|
|
|
{ |
483
|
|
|
$node |
484
|
|
|
->fixXmlConfig('routing_key') |
485
|
|
|
->children() |
486
|
|
|
->scalarNode('name')->end() |
487
|
|
|
->booleanNode('passive')->defaultFalse()->end() |
488
|
|
|
->booleanNode('durable')->defaultTrue()->end() |
489
|
|
|
->booleanNode('exclusive')->defaultFalse()->end() |
490
|
|
|
->booleanNode('auto_delete')->defaultFalse()->end() |
491
|
|
|
->booleanNode('nowait')->defaultFalse()->end() |
492
|
|
|
->booleanNode('declare')->defaultTrue()->end() |
493
|
|
|
->variableNode('arguments')->defaultNull()->end() |
494
|
|
|
->scalarNode('ticket')->defaultNull()->end() |
495
|
|
|
->arrayNode('routing_keys') |
496
|
|
|
->prototype('scalar')->end() |
497
|
|
|
->defaultValue(array()) |
498
|
|
|
->end() |
499
|
|
|
->end() |
500
|
|
|
; |
501
|
|
|
} |
502
|
|
|
} |
503
|
|
|
|