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