예제 #1
0
        public static WriteResponse Write(this IBoundaryWriter boundary, string request, int timeout, int repeatCount,
                                          int repeatTimeout)
        {
            int           count = 1;
            WriteResponse response;

            do
            {
                response = boundary.Write(request, timeout);
                if (response.Expired)
                {
                    Thread.Sleep(repeatTimeout);
                    count++;
                }
                else
                {
                    break;
                }
            } while (count <= repeatCount);

            if (count > repeatCount)
            {
                response.AddError(new LambdaFailureException(Properties.Resources.WriteCountException));
            }
            if (response.Expired)
            {
                response.AddError(new LambdaFailureException(Properties.Resources.WriteTimeOut));
            }

            return(response);
        }
예제 #2
0
 public ReadableBoundary Write <T>(T request, int timeout) where T : WriteRequest
 {
     try
     {
         Initialize();
         _writer.Write(request, timeout);
         _logger.Log(LogLevel.Info, AuditRequest(request));
         return(new ReadableBoundary(this));
     }
     catch (Exception exception)
     {
         _logger.Log(LogLevel.Error, exception.Message);
         throw;
     }
 }