Skip to content

Commit 04d9e9c

Browse files
committed
Async commands extended
1 parent 06b9876 commit 04d9e9c

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

DependencyInjection/Configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ private function getAsyncCommandsConfiguration(): ArrayNodeDefinition
7373
}
7474

7575
return (new ArrayNodeDefinition('async_commands'))
76+
->children()
77+
->booleanNode('enabled')->defaultFalse()->end()
78+
->integerNode('timeout')->min(0)->defaultValue(60)->end()
79+
->scalarNode('prefix')->defaultValue('')->end()
80+
->end()
7681
->addDefaultsIfNotSet()
7782
->canBeEnabled()
7883
;

DependencyInjection/EnqueueExtension.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,18 @@ private function loadReplyExtension(array $config, ContainerBuilder $container):
291291

292292
private function loadAsyncCommands(array $config, ContainerBuilder $container): void
293293
{
294-
$configNames = [];
294+
$configs = [];
295295
foreach ($config as $name => $modules) {
296296
if (false === empty($modules['async_commands']['enabled'])) {
297-
$configNames[] = $name;
297+
$configs[] = [
298+
'name' => $name,
299+
'timeout' => $modules['async_commands']['timeout'],
300+
'prefix' => $modules['async_commands']['prefix'],
301+
];
298302
}
299303
}
300304

301-
if (false == $configNames) {
305+
if (false == $configs) {
302306
return;
303307
}
304308

@@ -307,7 +311,7 @@ private function loadAsyncCommands(array $config, ContainerBuilder $container):
307311
}
308312

309313
$extension = new AsyncCommandExtension();
310-
$extension->load(['clients' => $configNames], $container);
314+
$extension->load(['clients' => $configs], $container);
311315
}
312316

313317
private function loadMessageQueueCollector(array $config, ContainerBuilder $container)

Tests/Functional/App/config/config.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ enqueue:
2828
traceable_producer: true
2929
job: true
3030
async_events: true
31-
async_commands: true
31+
async_commands:
32+
enabled: true
33+
timeout: 60
34+
prefix: ''
3235

3336
services:
3437
test_enqueue.client.default.traceable_producer:
@@ -122,4 +125,4 @@ services:
122125
enqueue.events.async_listener:
123126
class: 'Enqueue\Bundle\Tests\Functional\App\AsyncListener'
124127
public: true
125-
arguments: ['@enqueue.client.default.producer', '@enqueue.events.registry']
128+
arguments: ['@enqueue.client.default.producer', '@enqueue.events.registry']

0 commit comments

Comments
 (0)