File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Enqueue \LaravelQueue ;
4
4
5
+ use Enqueue \AmqpTools \DelayStrategyAware ;
6
+ use Enqueue \AmqpTools \RabbitMqDlxDelayStrategy ;
5
7
use Interop \Amqp \AmqpContext ;
6
8
7
9
class AmqpConnector extends Connector
@@ -10,11 +12,15 @@ public function connect(array $config)
10
12
{
11
13
$ queue = parent ::connect ($ config );
12
14
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 ())));
15
19
}
16
20
17
- // TODO set delay strategy.
21
+ if ($ amqpContext instanceof DelayStrategyAware) {
22
+ $ amqpContext ->setDelayStrategy (new RabbitMqDlxDelayStrategy ());
23
+ }
18
24
19
25
return $ queue ;
20
26
}
You can’t perform that action at this time.
0 commit comments