@@ -72,11 +72,14 @@ public function push($job, $data = '', $queue = null)
7272 public function pushRaw ($ payload , $ queueName = null , array $ options = [])
7373 {
7474 try {
75- /** @var AmqpTopic $topic */
76- list (, $ topic ) = $ this ->declareEverything ($ queueName );
75+ /**
76+ * @var AmqpTopic $topic
77+ * @var AmqpQueue $queue
78+ */
79+ list ($ queue , $ topic ) = $ this ->declareEverything ($ queueName );
7780
7881 $ message = $ this ->context ->createMessage ($ payload );
79- $ message ->setRoutingKey ($ queueName );
82+ $ message ->setRoutingKey ($ queue -> getQueueName () );
8083 $ message ->setCorrelationId ($ this ->getCorrelationId ());
8184 $ message ->setContentType ('application/json ' );
8285 $ message ->setDeliveryMode (AmqpMessage::DELIVERY_MODE_PERSISTENT );
@@ -116,14 +119,7 @@ public function pop($queueName = null)
116119 $ consumer = $ this ->context ->createConsumer ($ queue );
117120
118121 if ($ message = $ consumer ->receiveNoWait ()) {
119- return new RabbitMQJob (
120- $ this ->container ,
121- $ this ,
122- $ consumer ,
123- $ queueName ,
124- $ message ,
125- $ this ->connectionName
126- );
122+ return new RabbitMQJob ($ this ->container , $ this , $ consumer , $ message );
127123 }
128124 } catch (\Exception $ exception ) {
129125 $ this ->reportConnectionError ('pop ' , $ exception );
@@ -179,7 +175,7 @@ public function getContext(): AmqpContext
179175 *
180176 * @return array [Interop\Amqp\AmqpQueue, Interop\Amqp\AmqpTopic]
181177 */
182- private function declareEverything (string $ queueName ): array
178+ private function declareEverything (string $ queueName = null ): array
183179 {
184180 $ queueName = $ queueName ?: $ this ->defaultQueue ;
185181 $ exchangeName = $ this ->configExchange ['name ' ] ?: $ queueName ;
@@ -224,7 +220,7 @@ private function declareEverything(string $queueName): array
224220 }
225221
226222 if ($ this ->declareBindQueue ) {
227- $ this ->context ->bind (new AmqpBind ($ queue , $ topic , $ queueName ));
223+ $ this ->context ->bind (new AmqpBind ($ queue , $ topic , $ queue -> getQueueName () ));
228224 }
229225
230226 return [$ queue , $ topic ];
0 commit comments