Ejemplo n.º 1
0
        public int StoreMessage(MDSMessageRecord messageRecord)
        {
            var       startTime     = DateTime.Now;
            Exception lastException = null;

            while (DateTime.Now.Subtract(startTime).TotalMilliseconds < TimeOut)
            {
                try
                {
                    return(_storageManager.StoreMessage(messageRecord));
                }
                catch (Exception ex)
                {
                    Logger.Warn(ex.Message, ex);
                    lastException = ex;
                    Thread.Sleep(WaitTimeBeforeRetry);
                    RestartStorageManager();
                }
            }

            throw new MDSDatabaseException("Can not performed a database operation.", lastException);
        }
        public int StoreMessage(MDSMessageRecord messageRecord)
        {
            var startTime = DateTime.Now;
            Exception lastException = null;
            while (DateTime.Now.Subtract(startTime).TotalMilliseconds < TimeOut)
            {
                try
                {
                    return _storageManager.StoreMessage(messageRecord);
                }
                catch (Exception ex)
                {
                    Logger.Warn(ex.Message, ex);
                    lastException = ex;
                    Thread.Sleep(WaitTimeBeforeRetry);
                    RestartStorageManager();
                }
            }

            throw new MDSDatabaseException("Can not performed a database operation.", lastException);
        }