@@ -129,10 +129,12 @@ protected function getQueueExtension(Arguments $args, LoggerInterface $logger):
129129
130130 $ limitAttempsExtension ->getEventManager ()->on (new FailedJobsListener ());
131131
132+ $ configKey = (string )$ args ->getOption ('config ' );
133+ $ config = QueueManager::getConfig ($ configKey );
134+
132135 $ extensions = [
133136 new LoggerExtension ($ logger ),
134137 $ limitAttempsExtension ,
135- new RemoveUniqueJobIdFromCacheExtension ('Cake/Queue.queueUnique ' ),
136138 ];
137139
138140 if (!is_null ($ args ->getOption ('max-jobs ' ))) {
@@ -145,6 +147,10 @@ protected function getQueueExtension(Arguments $args, LoggerInterface $logger):
145147 $ extensions [] = new LimitConsumptionTimeExtension ($ endTime );
146148 }
147149
150+ if (isset ($ config ['uniqueCacheKey ' ])) {
151+ $ extensions [] = new RemoveUniqueJobIdFromCacheExtension ($ config ['uniqueCacheKey ' ]);
152+ }
153+
148154 return new ChainExtension ($ extensions );
149155 }
150156
@@ -171,16 +177,16 @@ protected function getLogger(Arguments $args): LoggerInterface
171177 */
172178 public function execute (Arguments $ args , ConsoleIo $ io ): int
173179 {
174- $ logger = $ this ->getLogger ($ args );
175- $ processor = new Processor ($ logger , $ this ->container );
176- $ extension = $ this ->getQueueExtension ($ args , $ logger );
177-
178180 $ config = (string )$ args ->getOption ('config ' );
179181 if (!Configure::check (sprintf ('Queue.%s ' , $ config ))) {
180182 $ io ->error (sprintf ('Configuration key "%s" was not found ' , $ config ));
181183 $ this ->abort ();
182184 }
183185
186+ $ logger = $ this ->getLogger ($ args );
187+ $ processor = new Processor ($ logger , $ this ->container );
188+ $ extension = $ this ->getQueueExtension ($ args , $ logger );
189+
184190 $ hasListener = Configure::check (sprintf ('Queue.%s.listener ' , $ config ));
185191 if ($ hasListener ) {
186192 $ listenerClassName = Configure::read (sprintf ('Queue.%s.listener ' , $ config ));
@@ -197,7 +203,7 @@ public function execute(Arguments $args, ConsoleIo $io): int
197203 $ queue = $ args ->getOption ('queue ' )
198204 ? (string )$ args ->getOption ('queue ' )
199205 : Configure::read ("Queue. {$ config }.queue " , 'default ' );
200- $ processorName = $ args ->getOption ('processor ' ) ? (string )$ args ->getOption ('processor ' ) : null ;
206+ $ processorName = $ args ->getOption ('processor ' ) ? (string )$ args ->getOption ('processor ' ) : ' default ' ;
201207
202208 $ client ->bindTopic ($ queue , $ processor , $ processorName );
203209 $ client ->consume ($ extension );
0 commit comments