try
{
$this->connection = new AMQPStreamConnection(
'localhost',
5672,
$this->config->user,
$this->config->password,
);
$this->channel = $this->connection->channel();
$this->channel->queue_declare($this->config->reviewQueueName, false, false, false, false);
$this->channel->queue_declare($this->config->emailQueueName, false, false, false, false);
if (is_cli())
{
$this->commonLib->cliLog('Connected to rabbit MQ');
}
}
catch (\Exception $e)
{
if (is_cli())
{
$this->commonLib->cliLog('FAILED: could not connect to MQ');
$this->commonLib->cliLog("REASON: {$e->getMessage()}");
log_message('error', $e->getMessage());
}
else
{
throw new \RuntimeException($e->getMessage(), $e->getCode());
}
exit();
}