コード例 #1
0
 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();
         }
     }
 }
コード例 #2
0
 private void ReConnect()
 {
     _connection = RabbitMQUtils.CreateNewConnection(_setting);
     Binding();
     _reconnectTimes = 1;
 }