Skip to content

Commit 4e5afe3

Browse files
committed
Merge pull request #163 from jamesmoey/add_qos_options_rpc_server
Add qos_options configurable to rpc_servers
2 parents 7674cc9 + 722ad0e commit 4e5afe3

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ public function getConfigTreeBuilder()
8989
->children()
9090
->scalarNode('connection')->defaultValue('default')->end()
9191
->scalarNode('callback')->isRequired()->end()
92+
->arrayNode('qos_options')
93+
->canBeUnset()
94+
->children()
95+
->scalarNode('prefetch_size')->defaultValue(0)->end()
96+
->scalarNode('prefetch_count')->defaultValue(0)->end()
97+
->booleanNode('global')->defaultFalse()->end()
98+
->end()
99+
->end()
92100
->end()
93101
->end()
94102
->end()

DependencyInjection/OldSoundRabbitMqExtension.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,13 @@ protected function loadRpcServers()
249249
if ($this->collectorEnabled) {
250250
$this->injectLoggedChannel($definition, $key, $server['connection']);
251251
}
252-
252+
if (array_key_exists('qos_options', $server)) {
253+
$definition->addMethodCall('setQosOptions', array(
254+
$server['qos_options']['prefetch_size'],
255+
$server['qos_options']['prefetch_count'],
256+
$server['qos_options']['global']
257+
));
258+
}
253259
$this->container->setDefinition(sprintf('old_sound_rabbit_mq.%s_server', $key), $definition);
254260
}
255261
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ rpc_servers:
375375
random_int:
376376
connection: default
377377
callback: random_int_server
378+
qos_options: {prefetch_size: 0, prefetch_count: 1, global: false}
378379
```
379380
380381
Here we have a very useful server: it returns random integers to its clients. The callback used to process the request will be the __random\_int\_server__ service. Now let's see how to invoke it from our controllers.

0 commit comments

Comments
 (0)