Skip to content

Commit 80392e1

Browse files
author
Bogdan Rancichi
committed
complete the build of batch consumers from extensions
1 parent 1d59ce9 commit 80392e1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

DependencyInjection/OldSoundRabbitMqExtension.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,19 @@ protected function loadBatchConsumers()
353353
{
354354
foreach ($this->config['batch_consumers'] as $key => $consumer) {
355355
$definition = new Definition('%old_sound_rabbit_mq.batch_consumer.class%');
356+
357+
if (!isset($consumer['exchange_options'])) {
358+
$consumer['exchange_options'] = $this->getDefaultExchangeOptions();
359+
}
360+
356361
$definition
357362
->addTag('old_sound_rabbit_mq.base_amqp')
358-
->addTag('old_sound_rabbit_mq.consumer')
359363
->addTag('old_sound_rabbit_mq.batch_consumer')
360364
->addMethodCall('setTimeoutWait', array($consumer['timeout_wait']))
361365
->addMethodCall('setPrefetchCount', array($consumer['qos_options']['prefetch_count']))
366+
->addMethodCall('setBatchCallback', array(array(new Reference($consumer['callback']), 'batchExecute')))
362367
->addMethodCall('setExchangeOptions', array($this->normalizeArgumentKeys($consumer['exchange_options'])))
368+
->addMethodCall('setQueueOptions', array($this->normalizeArgumentKeys($consumer['queue_options'])))
363369
->addMethodCall('setCallback', array(array(new Reference($consumer['callback']), 'execute')))
364370
->addMethodCall('setQosOptions', array(
365371
$consumer['qos_options']['prefetch_size'],
@@ -385,8 +391,7 @@ protected function loadBatchConsumers()
385391
$this->injectLogger($definition);
386392
}
387393

388-
$name = sprintf('old_sound_rabbit_mq.%s_batch', $key);
389-
$this->container->setDefinition($name, $definition);
394+
$this->container->setDefinition(sprintf('old_sound_rabbit_mq.%s_batch', $key), $definition);
390395
}
391396
}
392397

0 commit comments

Comments
 (0)