@@ -314,21 +314,22 @@ protected function _getConnection()
314314 {
315315 $ this ->_getHosts ();
316316 $ host = reset ($ this ->_hosts );
317+ $ config = $ this ->config ();
317318 try
318319 {
319320 $ this ->_connection = new AMQPStreamConnection (
320321 $ host ,
321- $ this -> config () ->getItem ('port ' , 5672 ),
322- $ this -> config () ->getItem ('username ' , 'guest ' ),
323- $ this -> config () ->getItem ('password ' , 'guest ' )
322+ $ config ->getItem ('port ' , 5672 ),
323+ $ config ->getItem ('username ' , 'guest ' ),
324+ $ config ->getItem ('password ' , 'guest ' )
324325 );
325326 }
326327 catch (\Exception $ e )
327328 {
328329 $ this ->_log ('AMQP host failed to connect ( ' . $ host . ') ' );
329330 array_shift ($ this ->_hosts );
330331 }
331- $ this ->_persistentDefault = (bool )$ this -> config () ->getItem (
332+ $ this ->_persistentDefault = (bool )$ config ->getItem (
332333 'persistent ' ,
333334 false
334335 );
@@ -390,29 +391,31 @@ public function setPrefetch($count, $size = 0)
390391
391392 public function declareQueue ()
392393 {
394+ $ config = $ this ->config ();
393395 $ this ->_getChannel ()->queue_declare (
394396 $ this ->_getQueueName (),
395- (bool )$ this -> config () ->getItem ('queue_passive ' , false ),
396- (bool )$ this -> config () ->getItem ('queue_durable ' , true ),
397- (bool )$ this -> config () ->getItem ('queue_exclusive ' , false ),
398- (bool )$ this -> config () ->getItem ('queue_autodelete ' , false ),
399- (bool )$ this -> config () ->getItem ('queue_nowait ' , false ),
400- (array )$ this -> config () ->getItem ('queue_args ' , null )
397+ (bool )$ config ->getItem ('queue_passive ' , false ),
398+ (bool )$ config ->getItem ('queue_durable ' , true ),
399+ (bool )$ config ->getItem ('queue_exclusive ' , false ),
400+ (bool )$ config ->getItem ('queue_autodelete ' , false ),
401+ (bool )$ config ->getItem ('queue_nowait ' , false ),
402+ (array )$ config ->getItem ('queue_args ' , null )
401403 );
402404 return $ this ;
403405 }
404406
405407 public function declareExchange ()
406408 {
409+ $ config = $ this ->config ();
407410 $ this ->_getChannel ()->exchange_declare (
408411 $ this ->_getExchangeName (),
409- (string )$ this -> config () ->getItem ('exchange_type ' , 'direct ' ),
410- (bool )$ this -> config () ->getItem ('exchange_passive ' , false ),
411- (bool )$ this -> config () ->getItem ('exchange_durable ' , true ),
412- (bool )$ this -> config () ->getItem ('exchange_autodelete ' , false ),
413- (bool )$ this -> config () ->getItem ('exchange_internal ' , false ),
414- (bool )$ this -> config () ->getItem ('exchange_nowait ' , false ),
415- (array )$ this -> config () ->getItem ('exchange_args ' , null )
412+ (string )$ config ->getItem ('exchange_type ' , 'direct ' ),
413+ (bool )$ config ->getItem ('exchange_passive ' , false ),
414+ (bool )$ config ->getItem ('exchange_durable ' , true ),
415+ (bool )$ config ->getItem ('exchange_autodelete ' , false ),
416+ (bool )$ config ->getItem ('exchange_internal ' , false ),
417+ (bool )$ config ->getItem ('exchange_nowait ' , false ),
418+ (array )$ config ->getItem ('exchange_args ' , null )
416419 );
417420 return $ this ;
418421 }
0 commit comments