Skip to content

Commit b15f3b9

Browse files
committed
[symfony] add info that describes config options.
1 parent 2c1e8fd commit b15f3b9

2 files changed

Lines changed: 36 additions & 282 deletions

File tree

‎docs/bundle/config_reference.md‎

Lines changed: 12 additions & 278 deletions
Original file line numberDiff line numberDiff line change
@@ -5,289 +5,21 @@ You can get this info by running `./bin/console config:dump-reference enqueue` c
55
```yaml
66
# Default configuration for extension with alias: "enqueue"
77
enqueue:
8-
transport: # Required
9-
default:
10-
alias: ~
11-
dsn: ~
12-
null:
13-
dsn: ~
14-
stomp:
15-
host: localhost
16-
port: 61613
17-
login: guest
18-
password: guest
19-
vhost: /
20-
sync: true
21-
connection_timeout: 1
22-
buffer_size: 1000
23-
lazy: true
24-
25-
# Should be true if you want to use secure connections. False by default
26-
ssl_on: false
27-
rabbitmq_stomp:
28-
host: localhost
29-
port: 61613
30-
login: guest
31-
password: guest
32-
vhost: /
33-
sync: true
34-
connection_timeout: 1
35-
buffer_size: 1000
36-
lazy: true
37-
ssl_on: false
388

39-
# The option tells whether RabbitMQ broker has management plugin installed or not
40-
management_plugin_installed: false
41-
management_plugin_port: 15672
9+
# The transport option could accept a string DSN, an array with DSN key, or null. It accept extra options. To find out what option you can set, look at connection factory constructor docblock.
10+
transport:
4211

43-
# The option tells whether RabbitMQ broker has delay plugin installed or not
44-
delay_plugin_installed: false
45-
amqp:
46-
driver: ~
12+
# The broker DSN. These schemes are supported: "file", "amqp", "amqps", "db2", "ibm-db2", "mssql", "sqlsrv", "mysql", "mysql2", "pgsql", "postgres", "sqlite", "sqlite3", "null", "gearman", "beanstalk", "kafka", "rdkafka", "redis", "stomp", "sqs", "gps", "mongodb", to use these "file", "amqp", "amqps", "db2", "ibm-db2", "mssql", "sqlsrv", "mysql", "mysql2", "pgsql", "postgres", "sqlite", "sqlite3", "null", "gearman", "beanstalk", "kafka", "rdkafka", "redis", "stomp", "sqs", "gps", "mongodb" you have to install a package.
13+
dsn: ~ # Required
4714

48-
# The connection to AMQP broker set as a string. Other parameters could be used as defaults
49-
dsn: ~
15+
# The connection factory class should implement "Interop\Queue\PsrConnectionFactory" interface
16+
connection_factory_class: ~
5017

51-
# The host to connect too. Note: Max 1024 characters
52-
host: ~
18+
# The factory class should implement "Enqueue\ConnectionFactoryFactoryInterface" interface
19+
factory_service: ~
5320

54-
# Port on the host.
55-
port: ~
56-
57-
# The user name to use. Note: Max 128 characters.
58-
user: ~
59-
60-
# Password. Note: Max 128 characters.
61-
pass: ~
62-
63-
# The virtual host on the host. Note: Max 128 characters.
64-
vhost: ~
65-
66-
# Connection timeout. Note: 0 or greater seconds. May be fractional.
67-
connection_timeout: ~
68-
69-
# Timeout in for income activity. Note: 0 or greater seconds. May be fractional.
70-
read_timeout: ~
71-
72-
# Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional.
73-
write_timeout: ~
74-
75-
# How often to send heartbeat. 0 means off.
76-
heartbeat: ~
77-
persisted: ~
78-
lazy: ~
79-
80-
# The receive strategy to be used. We suggest to use basic_consume as it is more performant. Though you need AMQP extension 1.9.1 or higher
81-
receive_method: ~ # One of "basic_get"; "basic_consume"
82-
83-
# The server will send a message in advance if it is equal to or smaller in size than the available prefetch size. May be set to zero, meaning "no specific limit"
84-
qos_prefetch_size: ~
85-
86-
# Specifies a prefetch window in terms of whole messages
87-
qos_prefetch_count: ~
88-
89-
# If "false" the QoS settings apply to the current channel only. If this field is "true", they are applied to the entire connection.
90-
qos_global: ~
91-
92-
# The options that are specific to the amqp transport you chose. For example amqp+lib have insist, keepalive, stream options. amqp+bunny has tcp_nodelay extra option.
93-
driver_options: ~
94-
95-
# Should be true if you want to use secure connections. False by default
96-
ssl_on: ~
97-
98-
# This option determines whether ssl client verifies that the server cert is for the server it is known as. True by default.
99-
ssl_verify: ~
100-
101-
# Location of Certificate Authority file on local filesystem which should be used with the verify_peer context option to authenticate the identity of the remote peer. A string.
102-
ssl_cacert: ~
103-
104-
# Path to local certificate file on filesystem. It must be a PEM encoded file which contains your certificate and private key. A string
105-
ssl_cert: ~
106-
107-
# Path to local private key file on filesystem in case of separate files for certificate (local_cert) and private key. A string.
108-
ssl_key: ~
109-
rabbitmq_amqp:
110-
driver: ~
111-
112-
# The connection to AMQP broker set as a string. Other parameters could be used as defaults
113-
dsn: ~
114-
115-
# The host to connect too. Note: Max 1024 characters
116-
host: ~
117-
118-
# Port on the host.
119-
port: ~
120-
121-
# The user name to use. Note: Max 128 characters.
122-
user: ~
123-
124-
# Password. Note: Max 128 characters.
125-
pass: ~
126-
127-
# The virtual host on the host. Note: Max 128 characters.
128-
vhost: ~
129-
130-
# Connection timeout. Note: 0 or greater seconds. May be fractional.
131-
connection_timeout: ~
132-
133-
# Timeout in for income activity. Note: 0 or greater seconds. May be fractional.
134-
read_timeout: ~
135-
136-
# Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional.
137-
write_timeout: ~
138-
139-
# How often to send heartbeat. 0 means off.
140-
heartbeat: ~
141-
persisted: ~
142-
lazy: ~
143-
144-
# The receive strategy to be used. We suggest to use basic_consume as it is more performant. Though you need AMQP extension 1.9.1 or higher
145-
receive_method: ~ # One of "basic_get"; "basic_consume"
146-
147-
# The server will send a message in advance if it is equal to or smaller in size than the available prefetch size. May be set to zero, meaning "no specific limit"
148-
qos_prefetch_size: ~
149-
150-
# Specifies a prefetch window in terms of whole messages
151-
qos_prefetch_count: ~
152-
153-
# If "false" the QoS settings apply to the current channel only. If this field is "true", they are applied to the entire connection.
154-
qos_global: ~
155-
156-
# The options that are specific to the amqp transport you chose. For example amqp+lib have insist, keepalive, stream options. amqp+bunny has tcp_nodelay extra option.
157-
driver_options: ~
158-
159-
# Should be true if you want to use secure connections. False by default
160-
ssl_on: ~
161-
162-
# This option determines whether ssl client verifies that the server cert is for the server it is known as. True by default.
163-
ssl_verify: ~
164-
165-
# Location of Certificate Authority file on local filesystem which should be used with the verify_peer context option to authenticate the identity of the remote peer. A string.
166-
ssl_cacert: ~
167-
168-
# Path to local certificate file on filesystem. It must be a PEM encoded file which contains your certificate and private key. A string
169-
ssl_cert: ~
170-
171-
# Path to local private key file on filesystem in case of separate files for certificate (local_cert) and private key. A string.
172-
ssl_key: ~
173-
174-
# The delay strategy to be used. Possible values are "dlx", "delayed_message_plugin" or service id
175-
delay_strategy: dlx
176-
fs:
177-
178-
# The path to a directory where to store messages given as DSN. For example file://tmp/foo
179-
dsn: ~
180-
181-
# The store directory where all queue\topics files will be created and messages are stored
182-
path: ~
183-
184-
# The option tells how many messages should be read from file at once. The feature save resources but could lead to bigger messages lose.
185-
pre_fetch_count: 1
186-
187-
# The queue files are created with this given permissions if not exist.
188-
chmod: 384
189-
190-
# How often query for new messages.
191-
polling_interval: 100
192-
redis:
193-
194-
# The redis connection given as DSN. For example redis://host:port?vendor=predis
195-
dsn: ~
196-
197-
# can be a host, or the path to a unix domain socket
198-
host: ~
199-
port: ~
200-
201-
# The library used internally to interact with Redis server
202-
vendor: ~ # One of "phpredis"; "predis"; "custom"
203-
204-
# A custom redis service id, used with vendor true only
205-
redis: ~
206-
207-
# bool, Whether it use single persisted connection or open a new one for every context
208-
persisted: false
209-
210-
# the connection will be performed as later as possible, if the option set to true
211-
lazy: true
212-
213-
# Database index to select when connected.
214-
database: 0
215-
dbal:
216-
217-
# The Doctrine DBAL DSN. Other parameters are ignored if set
218-
dsn: ~
219-
220-
# Doctrine DBAL connection options. See http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html
221-
connection: ~
222-
223-
# Doctrine dbal connection name.
224-
dbal_connection_name: null
225-
226-
# Database table name.
227-
table_name: enqueue
228-
229-
# How often query for new messages.
230-
polling_interval: 1000
231-
lazy: true
232-
sqs:
233-
client: null
234-
key: null
235-
secret: null
236-
token: null
237-
region: ~ # Required
238-
retries: 3
239-
version: '2012-11-05'
240-
241-
# the connection will be performed as later as possible, if the option set to true
242-
lazy: true
243-
endpoint: null
244-
gps:
245-
246-
# The connection to Google Pub/Sub broker set as a string. Other parameters are ignored if set
247-
dsn: ~
248-
249-
# The project ID from the Google Developer's Console.
250-
projectId: ~
251-
252-
# The full path to your service account credentials.json file retrieved from the Google Developers Console.
253-
keyFilePath: ~
254-
255-
# Number of retries for a failed request.
256-
retries: 3
257-
258-
# Scopes to be used for the request.
259-
scopes: []
260-
261-
# The connection will be performed as later as possible, if the option set to true
262-
lazy: true
263-
rdkafka:
264-
265-
# The kafka DSN. Other parameters are ignored if set
266-
dsn: ~
267-
268-
# The kafka global configuration properties
269-
global: []
270-
271-
# The kafka topic configuration properties
272-
topic: []
273-
274-
# Delivery report callback
275-
dr_msg_cb: ~
276-
277-
# Error callback
278-
error_cb: ~
279-
280-
# Called after consumer group has been rebalanced
281-
rebalance_cb: ~
282-
283-
# Which partitioner to use
284-
partitioner: ~ # One of "RD_KAFKA_MSG_PARTITIONER_RANDOM"; "RD_KAFKA_MSG_PARTITIONER_CONSISTENT"
285-
286-
# Logging level (syslog(3) levels)
287-
log_level: ~
288-
289-
# Commit asynchronous
290-
commit_async: false
21+
# The factory service should be a class that implements "Enqueue\ConnectionFactoryFactoryInterface" interface
22+
factory_class: ~
29123
client:
29224
traceable_producer: true
29325
prefix: enqueue
@@ -307,6 +39,8 @@ enqueue:
30739
job: false
30840
async_events:
30941
enabled: false
42+
async_commands:
43+
enabled: false
31044
extensions:
31145
doctrine_ping_connection_extension: false
31246
doctrine_clear_identity_map_extension: false

‎pkg/enqueue/Symfony/DependencyInjection/TransportFactory.php‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Enqueue\Symfony\DependencyInjection;
44

55
use Enqueue\Client\DriverInterface;
6+
use Enqueue\ConnectionFactoryFactoryInterface;
7+
use Enqueue\Resources;
68
use Interop\Queue\PsrConnectionFactory;
79
use Interop\Queue\PsrContext;
810
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
@@ -31,7 +33,11 @@ public function __construct(string $name)
3133

3234
public function addConfiguration(ArrayNodeDefinition $builder): void
3335
{
36+
$knownSchemes = array_keys(Resources::getKnownSchemes());
37+
$availableSchemes = array_keys(Resources::getAvailableSchemes());
38+
3439
$builder
40+
->info('The transport option could accept a string DSN, an array with DSN key, or null. It accept extra options. To find out what option you can set, look at connection factory constructor docblock.')
3541
->beforeNormalization()
3642
->always(function ($v) {
3743
if (empty($v)) {
@@ -59,10 +65,24 @@ public function addConfiguration(ArrayNodeDefinition $builder): void
5965
->end()
6066
->ignoreExtraKeys(false)
6167
->children()
62-
->scalarNode('dsn')->cannotBeEmpty()->isRequired()->end()
63-
->scalarNode('connection_factory_class')->end()
64-
->scalarNode('factory_service')->end()
65-
->scalarNode('factory_class')->end()
68+
->scalarNode('dsn')
69+
->cannotBeEmpty()
70+
->isRequired()
71+
->info(sprintf(
72+
'The MQ broker DSN. These schemes are supported: "%s", to use these "%s" you have to install a package.',
73+
implode('", "', $knownSchemes),
74+
implode('", "', $availableSchemes)
75+
))
76+
->end()
77+
->scalarNode('connection_factory_class')
78+
->info(sprintf('The connection factory class should implement "%s" interface', PsrConnectionFactory::class))
79+
->end()
80+
->scalarNode('factory_service')
81+
->info(sprintf('The factory class should implement "%s" interface', ConnectionFactoryFactoryInterface::class))
82+
->end()
83+
->scalarNode('factory_class')
84+
->info(sprintf('The factory service should be a class that implements "%s" interface', ConnectionFactoryFactoryInterface::class))
85+
->end()
6686
->end()
6787
;
6888
}

0 commit comments

Comments
 (0)