12
12
namespace Symfony \Component \Messenger \Command ;
13
13
14
14
use Psr \Container \ContainerInterface ;
15
+ use Psr \Log \LoggerInterface ;
15
16
use Symfony \Component \Console \Command \Command ;
16
17
use Symfony \Component \Console \Input \InputArgument ;
17
18
use Symfony \Component \Console \Input \InputInterface ;
@@ -34,13 +35,15 @@ class ConsumeMessagesCommand extends Command
34
35
35
36
private $ bus ;
36
37
private $ receiverLocator ;
38
+ private $ logger ;
37
39
38
- public function __construct (MessageBusInterface $ bus , ContainerInterface $ receiverLocator )
40
+ public function __construct (MessageBusInterface $ bus , ContainerInterface $ receiverLocator, LoggerInterface $ logger = null )
39
41
{
40
42
parent ::__construct ();
41
43
42
44
$ this ->bus = $ bus ;
43
45
$ this ->receiverLocator = $ receiverLocator ;
46
+ $ this ->logger = $ logger ;
44
47
}
45
48
46
49
/**
@@ -86,11 +89,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
86
89
}
87
90
88
91
if ($ limit = $ input ->getOption ('limit ' )) {
89
- $ receiver = new MaximumCountReceiver ($ receiver , $ limit );
92
+ $ receiver = new MaximumCountReceiver ($ receiver , $ limit, $ this -> logger );
90
93
}
91
94
92
95
if ($ memoryLimit = $ input ->getOption ('memory-limit ' )) {
93
- $ receiver = new MemoryLimitReceiver ($ receiver , $ memoryLimit );
96
+ $ receiver = new MemoryLimitReceiver ($ receiver , $ memoryLimit, $ this -> logger );
94
97
}
95
98
96
99
$ worker = new Worker ($ receiver , $ this ->bus );
0 commit comments