/** * @param ConfigInterface $config */ public function __construct(ConfigInterface $config) { try { $this->config = $config->getConfig(); $this->logger = $this->prepareLogger($config); $this->connection = $this->prepareConnection(); $this->channel = $this->connection->channel(); $this->setQueues(); $this->setExchanges(); } catch (Exception $exception) { throw new Exception('AMQPAdapter can not be loaded. Check config settings and/or access to AMQP Server'); } }
/** * @param MessageQueuePHP\Config\ConfigInterface $config */ public function __construct(ConfigInterface $config) { #extract $host, $port, $key, $channel and $path extract($this->prepareConfig($config->getConfig())); $redisClient = new RedisClient(['scheme' => 'tcp', 'host' => $host, 'port' => $port]); try { $redisClient->ping(); $handler = new RedisHandler($redisClient, $key); } catch (Exception $e) { $handler = new StreamHandler($path); } $formatter = new LogstashFormatter($channel); $handler->setFormatter($formatter); $this->logger = new Logger($channel, array($handler)); }