Skip to content

Commit ddb978a

Browse files
author
Mostafa Abdel Baset
committed
set delay strategy based on config variable
1 parent 49e836a commit ddb978a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Queue/Connectors/RabbitMQConnector.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Enqueue\AmqpTools\DelayStrategyAware;
99
use Illuminate\Contracts\Events\Dispatcher;
1010
use Illuminate\Queue\Events\WorkerStopping;
11+
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
1112
use Enqueue\AmqpTools\RabbitMqDelayPluginDelayStrategy;
1213
use Illuminate\Queue\Connectors\ConnectorInterface;
1314
use VladimirYuldashev\LaravelQueueRabbitMQ\Queue\RabbitMQQueue;
@@ -61,7 +62,8 @@ public function connect(array $config): Queue
6162
]);
6263

6364
if ($factory instanceof DelayStrategyAware) {
64-
$factory->setDelayStrategy(new RabbitMqDelayPluginDelayStrategy());
65+
$delayStrategy = isset($config['options']['queue']['delay_strategy']) ? $config['options']['queue']['delay_strategy'] : 'RabbitMqDelayPluginDelayStrategy';
66+
$factory->setDelayStrategy(new $delayStrategy());
6567
}
6668

6769
/** @var AmqpContext $context */

0 commit comments

Comments
 (0)