Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Queue can optionaly be defined from the producer

  • Loading branch information...
commit 28ef331b3a48f8ccadea3c9a95716da5bbc79dec 1 parent ef478f1
@mvrhov authored
View
1  DependencyInjection/Configuration.php
@@ -41,6 +41,7 @@ public function getConfigTreeBuilder()
->useAttributeAsKey('key')
->prototype('array')
->append($this->getExchangeConfiguration())
+ ->append($this->getQueueConfiguration())
->children()
->scalarNode('connection')->defaultValue('default')->end()
->end()
View
3  DependencyInjection/OldSoundRabbitMqExtension.php
@@ -81,6 +81,9 @@ protected function loadProducers()
foreach ($this->config['producers'] as $key => $producer) {
$definition = new Definition('%old_sound_rabbit_mq.producer.class%');
$definition->addMethodCall('setExchangeOptions', array($producer['exchange_options']));
+ if (isset($producer['queue_options'])) {
+ $definition->addMethodCall('setQueueOptions', array($producer['queue_options']));
+ }
$this->injectConnection($definition, $producer['connection']);
if ($this->collectorEnabled) {
$this->injectLoggedChannel($definition, $key, $producer['connection']);
View
9 RabbitMq/Producer.php
@@ -22,6 +22,15 @@ public function exchangeDeclare()
$this->exchangeOptions['internal']);
$this->declared = true;
+
+ if (('' != $this->queueOptions['name']) && (null !== $this->queueOptions['name'])) {
+ list($queueName, ,) = $this->ch->queue_declare($this->queueOptions['name'], $this->queueOptions['passive'],
+ $this->queueOptions['durable'], $this->queueOptions['exclusive'],
+ $this->queueOptions['auto_delete'], $this->queueOptions['nowait'],
+ $this->queueOptions['arguments'], $this->queueOptions['ticket']);
+
+ $this->ch->queue_bind($queueName, $this->exchangeOptions['name'], $this->routingKey);
+ }
}
public function publish($msgBody, $routingKey = '')
Please sign in to comment.
Something went wrong with that request. Please try again.