BloombergFLP.CollectdWin.WriteAmqpPlugin.StartConnection C# (CSharp) Method

StartConnection() public method

public StartConnection ( ) : void
return void
        public void StartConnection()
        {
            double now = Util.GetNow();
            if (now < (_lastConnectTime + ConnectionRetryDelay))
            {
                return;
            }
            lock (_connectionLock)
            {
                try
                {
                    var cf = new ConnectionFactory {Uri = _url};
                    _connection = cf.CreateConnection();
                    _channel = _connection.CreateModel();

                    _connected = true;
                    _lastConnectTime = Util.GetNow();
                    Logger.Debug("Connection started.");
                }
                catch (Exception exp)
                {
                    LogEventInfo logEvent = new LogEventInfo(LogLevel.Error, Logger.Name, "Exception when connecting to AMQP broker");
                    logEvent.Exception = exp;
                    logEvent.Properties.Add("EventID", ErrorCodes.ERROR_UNHANDLED_EXCEPTION);
                    Logger.Log(logEvent);
                }
            }
        }