File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 22
33namespace Enqueue \LaravelQueue ;
44
5+ use Enqueue \AmqpTools \DelayStrategyAware ;
6+ use Enqueue \AmqpTools \RabbitMqDlxDelayStrategy ;
57use Interop \Amqp \AmqpContext ;
68
79class AmqpConnector extends Connector
@@ -10,11 +12,15 @@ public function connect(array $config)
1012 {
1113 $ queue = parent ::connect ($ config );
1214
13- if (false == $ queue ->getPsrContext () instanceof AmqpContext) {
14- throw new \LogicException (sprintf ('The context must be instance of "%s" but got "%s" ' , AmqpContext::class, get_class ($ queue ->getPsrContext ()));
15+ /** @var AmqpContext $amqpContext */
16+ $ amqpContext = $ queue ->getPsrContext ();
17+ if (false == $ amqpContext instanceof AmqpContext) {
18+ throw new \LogicException (sprintf ('The context must be instance of "%s" but got "%s" ' , AmqpContext::class, get_class ($ queue ->getPsrContext ())));
1519 }
1620
17- // TODO set delay strategy.
21+ if ($ amqpContext instanceof DelayStrategyAware) {
22+ $ amqpContext ->setDelayStrategy (new RabbitMqDlxDelayStrategy ());
23+ }
1824
1925 return $ queue ;
2026 }
You can’t perform that action at this time.
0 commit comments