コード例 #1
0
        public void SendSync(TRequest request)
        {
            if (request == null)
            {
                throw new HBIntegrationException("Request not defined.");
            }

            if (CurrentLog == null)
            {
                CurrentLog = CreateLog(request);
            }

            if (!Config.Enabled)
            {
                return;
            }

            try
            {
                CurrentLog.SetSending();

                var response = default(TResponse);

                var isValid = SendInternal(request, out response);

                if (isValid)
                {
                    CurrentLog.SetSuccess(response);
                }
            }
            catch (Exception ex)
            {
                CurrentLog.SetError(ex.Message);
                LoggerHelper.Error(ex);
            }
            finally
            {
                CurrentLog.Retries++;
                CurrentLog.Save();
            }
        }