Skip to content

Commit 25143fc

Browse files
committed
Added arguments for declaring an exchange
1 parent acc827b commit 25143fc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

config/rabbitmq.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'passive' => env('RABBITMQ_EXCHANGE_PASSIVE', false),
4545
'durable' => env('RABBITMQ_EXCHANGE_DURABLE', true),
4646
'auto_delete' => env('RABBITMQ_EXCHANGE_AUTODELETE', false),
47+
'arguments' => env('RABBITMQ_EXCHANGE_ARGUMENTS'),
4748
],
4849

4950
'queue' => [
@@ -71,9 +72,7 @@
7172
'exclusive' => env('RABBITMQ_QUEUE_EXCLUSIVE', false),
7273
'auto_delete' => env('RABBITMQ_QUEUE_AUTODELETE', false),
7374
'arguments' => env('RABBITMQ_QUEUE_ARGUMENTS'),
74-
7575
],
76-
7776
],
7877

7978
/*

src/Queue/RabbitMQQueue.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ public function __construct(AmqpContext $context, array $config)
3434
$this->context = $context;
3535

3636
$this->queueOptions = $config['options']['queue'];
37-
$this->queueOptions['arguments'] = isset($this->queueOptions['arguments']) ? json_decode($this->queueOptions['arguments'], true) : [];
37+
$this->queueOptions['arguments'] = isset($this->queueOptions['arguments']) ?
38+
json_decode($this->queueOptions['arguments'], true) : [];
3839

3940
$this->exchangeOptions = $config['options']['exchange'];
41+
$this->exchangeOptions['arguments'] = isset($this->exchangeOptions['arguments']) ?
42+
json_decode($this->exchangeOptions['arguments'], true) : [];
4043

4144
$this->sleepOnError = $config['sleep_on_error'] ?? 5;
4245
}
@@ -176,6 +179,7 @@ private function declareEverything(string $queueName = null): array
176179

177180
$topic = $this->context->createTopic($exchangeName);
178181
$topic->setType($this->exchangeOptions['type']);
182+
$topic->setArguments($this->exchangeOptions['arguments']);
179183
if ($this->exchangeOptions['passive']) {
180184
$topic->addFlag(AmqpTopic::FLAG_PASSIVE);
181185
}

0 commit comments

Comments
 (0)