|
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
|
|
|
use Symfony\Component\ExpressionLanguage\Expression; |
|
|
|
|
|
|
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
|
31 |
|
*/ |
|
27
|
|
|
public function __construct($name) |
|
28
|
31 |
|
{ |
|
29
|
31 |
|
$this->name = $name; |
|
30
|
|
|
} |
|
31
|
31 |
|
|
|
32
|
|
|
public function getConfigTreeBuilder() |
|
33
|
31 |
|
{ |
|
34
|
|
|
$tree = new TreeBuilder($this->name); |
|
35
|
31 |
|
/** @var ArrayNodeDefinition $rootNode */ |
|
36
|
|
|
$rootNode = $tree->getRootNode(); |
|
37
|
|
|
|
|
38
|
31 |
|
$rootNode |
|
39
|
31 |
|
->children() |
|
40
|
31 |
|
->booleanNode('debug')->defaultValue('%kernel.debug%')->end() |
|
41
|
31 |
|
->booleanNode('enable_collector')->defaultValue(false)->end() |
|
|
|
|
|
|
42
|
31 |
|
->booleanNode('sandbox')->defaultValue(false)->end() |
|
43
|
|
|
->end() |
|
44
|
|
|
; |
|
45
|
31 |
|
|
|
46
|
31 |
|
$this->addConnections($rootNode); |
|
47
|
31 |
|
$this->addDeclarations($rootNode); |
|
48
|
31 |
|
$this->addProducers($rootNode); |
|
49
|
31 |
|
|
|
50
|
31 |
|
$rootNode |
|
51
|
31 |
|
->children() |
|
52
|
31 |
|
->arrayNode('default_channel_optinos')->end() |
|
53
|
31 |
|
->end() |
|
|
|
|
|
|
54
|
31 |
|
; |
|
55
|
|
|
$this->addConsumers($rootNode); |
|
56
|
31 |
|
|
|
57
|
|
|
return $tree; |
|
58
|
|
|
} |
|
59
|
31 |
|
|
|
60
|
|
|
protected function addDeclarations(ArrayNodeDefinition $node) |
|
61
|
|
|
{ |
|
62
|
31 |
|
$node |
|
63
|
31 |
|
->fixXmlConfig('declaration') |
|
64
|
31 |
|
->children() |
|
65
|
31 |
|
->arrayNode('declarations') |
|
66
|
31 |
|
->children() |
|
67
|
31 |
|
->arrayNode('exchanges') |
|
68
|
31 |
|
->arrayPrototype() |
|
69
|
31 |
|
->children() |
|
70
|
31 |
|
->scalarNode('name')->isRequired()->end() |
|
71
|
31 |
|
->scalarNode('type')->isRequired()->end() |
|
|
|
|
|
|
72
|
31 |
|
->booleanNode('passive')->defaultValue(false)->end() |
|
73
|
31 |
|
->booleanNode('durable')->defaultValue(true)->end() |
|
74
|
31 |
|
->booleanNode('auto_delete')->defaultValue(false)->end() |
|
75
|
31 |
|
->booleanNode('internal')->defaultValue(false)->end() |
|
76
|
31 |
|
->booleanNode('nowait')->defaultValue(false)->end() |
|
77
|
31 |
|
->booleanNode('declare')->defaultValue(true)->end() |
|
78
|
31 |
|
->variableNode('arguments')->defaultNull()->end() |
|
79
|
31 |
|
->scalarNode('ticket')->defaultNull()->end() |
|
80
|
31 |
|
->arrayNode('bindings') |
|
81
|
31 |
|
->arrayPrototype() |
|
82
|
31 |
|
->children() |
|
83
|
31 |
|
->scalarNode('destination')->isRequired()->end() |
|
84
|
31 |
|
->booleanNode('destination_is_exchange')->defaultFalse()->end() |
|
85
|
31 |
|
->scalarNode('routing_key')->defaultValue(null)->end() |
|
86
|
31 |
|
->arrayNode('routing_keys')->defaultValue([])->scalarPrototype()->end()->end() |
|
87
|
31 |
|
->end() |
|
88
|
31 |
|
->end() |
|
89
|
31 |
|
->end() |
|
90
|
31 |
|
->end() |
|
91
|
|
|
->end() |
|
92
|
31 |
|
->end() |
|
93
|
|
|
->arrayNode('queues') |
|
94
|
31 |
|
->useAttributeAsKey('name') |
|
95
|
|
|
->arrayPrototype() |
|
96
|
|
|
->children() |
|
97
|
31 |
|
->scalarNode('name')->end() |
|
98
|
31 |
|
->booleanNode('anon')->defaultFalse()->end() |
|
99
|
31 |
|
->booleanNode('passive')->defaultFalse()->end() |
|
100
|
31 |
|
->booleanNode('durable')->defaultTrue()->end() |
|
101
|
31 |
|
->booleanNode('exclusive')->defaultFalse()->end() |
|
102
|
31 |
|
->booleanNode('auto_delete')->defaultFalse()->end() |
|
103
|
31 |
|
->booleanNode('nowait')->defaultFalse()->end() |
|
104
|
31 |
|
->booleanNode('declare')->defaultTrue()->end() |
|
105
|
31 |
|
->variableNode('arguments')->defaultNull()->end() |
|
106
|
31 |
|
->scalarNode('ticket')->defaultNull()->end() |
|
107
|
31 |
|
->arrayNode('bindings') |
|
108
|
31 |
|
->arrayPrototype() |
|
109
|
31 |
|
->children() |
|
110
|
31 |
|
->scalarNode('exchange')->end() |
|
111
|
31 |
|
->scalarNode('routing_key')->defaultValue(null)->end() |
|
112
|
31 |
|
->arrayNode('routing_keys')->defaultValue([])->scalarPrototype()->end()->end() |
|
113
|
31 |
|
->end() |
|
114
|
31 |
|
->end() |
|
115
|
|
|
->end() |
|
116
|
31 |
|
->end() |
|
117
|
|
|
->end() |
|
118
|
31 |
|
->end() |
|
119
|
|
|
->arrayNode('bindings') |
|
120
|
|
|
->arrayPrototype() |
|
121
|
31 |
|
->children() |
|
122
|
31 |
|
->scalarNode('exchange')->isRequired()->end() |
|
123
|
31 |
|
->scalarNode('destination')->isRequired()->end() |
|
124
|
31 |
|
->booleanNode('destination_is_exchange')->defaultFalse()->end() |
|
125
|
31 |
|
->scalarNode('routing_key')->defaultValue(null)->end() |
|
126
|
31 |
|
->arrayNode('routing_keys')->defaultValue([])->scalarPrototype()->end()->end() |
|
127
|
31 |
|
->end() |
|
128
|
31 |
|
->end() |
|
129
|
31 |
|
->end() |
|
130
|
31 |
|
->end() |
|
131
|
31 |
|
->end() |
|
132
|
31 |
|
; |
|
133
|
31 |
|
} |
|
134
|
31 |
|
|
|
135
|
31 |
|
protected function addConnections(ArrayNodeDefinition $node) |
|
136
|
31 |
|
{ |
|
137
|
31 |
|
$node |
|
138
|
31 |
|
->fixXmlConfig('connection') |
|
139
|
|
|
->children() |
|
140
|
31 |
|
->arrayNode('connections') |
|
141
|
|
|
->useAttributeAsKey('key') |
|
142
|
31 |
|
->canBeUnset() |
|
143
|
|
|
->prototype('array') |
|
144
|
|
|
->children() |
|
145
|
31 |
|
->scalarNode('url')->defaultValue('')->end() |
|
146
|
31 |
|
->scalarNode('host')->defaultValue('localhost')->end() |
|
147
|
31 |
|
->scalarNode('port')->defaultValue(5672)->end() |
|
148
|
31 |
|
->scalarNode('user')->defaultValue('guest')->end() |
|
149
|
31 |
|
->scalarNode('password')->defaultValue('guest')->end() |
|
150
|
31 |
|
->scalarNode('vhost')->defaultValue('/')->end() |
|
151
|
31 |
|
->booleanNode('lazy')->defaultFalse()->end() |
|
152
|
31 |
|
->scalarNode('connection_timeout')->defaultValue(3)->end() |
|
153
|
31 |
|
->scalarNode('read_write_timeout')->defaultValue(3)->end() |
|
154
|
31 |
|
->booleanNode('use_socket')->defaultValue(false)->end() |
|
155
|
31 |
|
->arrayNode('ssl_context') |
|
156
|
31 |
|
->useAttributeAsKey('key') |
|
157
|
31 |
|
->canBeUnset() |
|
158
|
31 |
|
->prototype('variable')->end() |
|
159
|
31 |
|
->end() |
|
160
|
31 |
|
->booleanNode('keepalive')->defaultFalse()->info('requires php-amqplib v2.4.1+ and PHP5.4+')->end() |
|
161
|
31 |
|
->scalarNode('heartbeat')->defaultValue(0)->info('requires php-amqplib v2.4.1+')->end() |
|
162
|
31 |
|
->scalarNode('connection_parameters_provider')->end() |
|
163
|
31 |
|
->end() |
|
164
|
31 |
|
->end() |
|
165
|
31 |
|
->end() |
|
166
|
31 |
|
->end() |
|
167
|
31 |
|
; |
|
168
|
31 |
|
} |
|
169
|
31 |
|
|
|
170
|
31 |
|
protected function addProducers(ArrayNodeDefinition $node) |
|
171
|
31 |
|
{ |
|
172
|
31 |
|
$node |
|
173
|
31 |
|
->fixXmlConfig('producer') |
|
174
|
31 |
|
->children() |
|
175
|
31 |
|
->arrayNode('producers') |
|
176
|
31 |
|
->canBeUnset() |
|
177
|
31 |
|
->useAttributeAsKey('key') |
|
178
|
31 |
|
->prototype('array') |
|
179
|
|
|
->children() |
|
180
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
|
181
|
|
|
->scalarNode('exchange')->defaultValue('')->end() |
|
182
|
31 |
|
->scalarNode('auto_declare')->defaultValue('%kernel.debug%')->end() |
|
183
|
|
|
->scalarNode('class')->defaultValue('%old_sound_rabbit_mq.producer.class%')->end() |
|
184
|
|
|
->scalarNode('logging')->defaultTrue()->end() |
|
185
|
31 |
|
->end() |
|
186
|
31 |
|
->end() |
|
187
|
31 |
|
->end() |
|
188
|
31 |
|
->end() |
|
189
|
31 |
|
; |
|
190
|
31 |
|
} |
|
191
|
31 |
|
|
|
192
|
31 |
|
|
|
193
|
31 |
|
protected function addConsumers(ArrayNodeDefinition $node) |
|
194
|
31 |
|
{ |
|
195
|
31 |
|
$node |
|
196
|
31 |
|
->fixXmlConfig('consumer') |
|
197
|
31 |
|
->children() |
|
198
|
31 |
|
->arrayNode('consumers') |
|
199
|
31 |
|
->canBeUnset() |
|
200
|
31 |
|
->prototype('array') |
|
201
|
31 |
|
->children() |
|
202
|
31 |
|
->scalarNode('connection')->defaultValue('default')->end() |
|
203
|
31 |
|
->scalarNode('logging')->defaultTrue()->end() |
|
204
|
31 |
|
->arrayNode('consumeQueues') |
|
205
|
31 |
|
->prototype('array') |
|
206
|
31 |
|
->children() |
|
207
|
31 |
|
->scalarNode('queue')->isRequired()->end() |
|
208
|
31 |
|
->scalarNode('receiver')->isRequired()->end() |
|
209
|
31 |
|
->scalarNode('qos_prefetch_size')->defaultValue(0)->end() |
|
210
|
31 |
|
->scalarNode('qos_prefetch_count')->defaultValue(0)->end() |
|
211
|
31 |
|
->scalarNode('batch_count')->end() |
|
212
|
31 |
|
->booleanNode('exclusive')->end() |
|
213
|
31 |
|
->booleanNode('auto_delete')->end() |
|
214
|
31 |
|
->end() |
|
215
|
31 |
|
->end() |
|
216
|
31 |
|
->end() |
|
217
|
31 |
|
->scalarNode('idle_timeout')->end() |
|
218
|
|
|
->scalarNode('idle_timeout_exit_code')->end() |
|
219
|
31 |
|
->scalarNode('timeout_wait')->end() |
|
220
|
|
|
->arrayNode('graceful_max_execution') |
|
221
|
31 |
|
->canBeUnset() |
|
222
|
|
|
->children() |
|
223
|
|
|
->integerNode('timeout')->end() |
|
224
|
31 |
|
->integerNode('exit_code')->defaultValue(0)->end() |
|
225
|
31 |
|
->end() |
|
226
|
31 |
|
->end() |
|
227
|
31 |
|
->scalarNode('auto_setup_fabric')->defaultTrue()->end() |
|
228
|
31 |
|
->arrayNode('qos_options') |
|
229
|
31 |
|
->canBeUnset() |
|
230
|
31 |
|
->children() |
|
231
|
31 |
|
->scalarNode('prefetch_size')->defaultValue(0)->end() |
|
232
|
31 |
|
->scalarNode('prefetch_count')->defaultValue(0)->end() |
|
233
|
31 |
|
->booleanNode('global')->defaultFalse()->end() |
|
234
|
31 |
|
->end() |
|
235
|
31 |
|
->end() |
|
236
|
31 |
|
->end() |
|
237
|
31 |
|
->end() |
|
238
|
31 |
|
->end() |
|
239
|
31 |
|
->end() |
|
240
|
31 |
|
; |
|
241
|
31 |
|
} |
|
242
|
31 |
|
|
|
243
|
|
|
} |
|
244
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths