public void Start(bool isAutoConnect = true) { try { _connection = RabbitMQUtils.CreateNewConnection(_setting); Binding(); } catch (Exception ex) { _logger.Error($"The rabbit mq service cannot connect! reason: {ex.GetExceptionMessage()}"); if (isAutoConnect) { _logger.Info($"Auto connect is enable, the service will reconnect to the rabbit mq server after {_setting.ReconnectTimeMillisecond} ms!"); TryReConnect(); } } }
private void ReConnect() { _connection = RabbitMQUtils.CreateNewConnection(_setting); Binding(); _reconnectTimes = 1; }