Skip to content

Commit 5c06bc0

Browse files
authored
Update RabbitMQQueue.php
1 parent ade0d17 commit 5c06bc0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Queue/RabbitMQQueue.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,18 @@ function ($payload, $queue, $delay) {
187187
public function laterRaw($delay, $payload, $queue = null, $attempts = 0)
188188
{
189189
$ttl = $this->secondsUntil($delay) * 1000;
190+
191+
// default options
192+
$options = ['delay' => $delay, 'attempts' => $attempts];
190193

191194
// When no ttl just publish a new message to the exchange or queue
192195
if ($ttl <= 0) {
193-
return $this->pushRaw($payload, $queue, ['delay' => $delay, 'attempts' => $attempts]);
196+
return $this->pushRaw($payload, $queue, $options);
194197
}
198+
199+
// Create a main queue to handle delayed messages
200+
[$mainDestination, $exchange, $exchangeType, $attempts] = $this->publishProperties($queue, $options);
201+
$this->declareDestination($mainDestination, $exchange, $exchangeType);
195202

196203
$destination = $this->getQueue($queue).'.delay.'.$ttl;
197204

0 commit comments

Comments
 (0)