Ejemplo n.º 1
0
 /**
  * @param ConfigInterface $mq_config
  * @return FactoryInterface
  * @throws Exception
  */
 public function getAdapter(ConfigInterface $mq_config)
 {
     $config = $mq_config->getAdapterFactoryConfig();
     if (empty($config['type'])) {
         throw new Exception("The message queue 'type' must provided in connection config.");
     }
     if ('testing' === $config['type']) {
         return $this->getTestingFactory($mq_config, $config);
     }
     if ('amqp' === $config['type']) {
         return new AmqpFactory($mq_config);
     }
     throw new Exception("A message queue adapter factory is not associated with '{$config['type']}'.");
 }