private function loadProducers($app)
 {
     $_this = $this;
     $app['rabbit.producer'] = $app->share(function ($app) use($_this) {
         if (!isset($app['rabbit.producers'])) {
             return;
         }
         $producers = array();
         foreach ($app['rabbit.producers'] as $name => $options) {
             $connection = $_this->getConnection($app, $options, $app['rabbit.connections']);
             $producer = new Producer($connection);
             $producer->setExchangeOptions($options['exchange_options']);
             if (array_key_exists('auto_setup_fabric', $options) && !$options['auto_setup_fabric']) {
                 $producer->disableAutoSetupFabric();
             }
             $producers[$name] = $producer;
         }
         return $producers;
     });
 }
 private function loadProducers($app)
 {
     $app['rabbit.producer'] = $app->share(function ($app) {
         if (!isset($app['rabbit.producers'])) {
             return;
         }
         $producers = [];
         foreach ($app['rabbit.producers'] as $name => $options) {
             $connection = $this->getConnection($app, $options, $app['rabbit.connections']);
             $producer = new Producer($connection);
             $producer->setExchangeOptions($options['exchange_options']);
             //this producer doesn't define a queue
             if (!isset($options['queue_options'])) {
                 $options['queue_options']['name'] = null;
             }
             $producer->setQueueOptions($options['queue_options']);
             if (array_key_exists('auto_setup_fabric', $options) && !$options['auto_setup_fabric']) {
                 $producer->disableAutoSetupFabric();
             }
             $producers[$name] = $producer;
         }
         return $producers;
     });
 }