Beispiel #1
0
 protected void RelinquishRequest()
 {
     using (RequestJobProvider rjProvider = new RequestJobProvider(this.RequestQueueGuid, this.SystemMailbox))
     {
         MapiUtils.RetryOnObjectChanged(delegate
         {
             using (TransactionalRequestJob transactionalRequestJob = (TransactionalRequestJob)rjProvider.Read <TransactionalRequestJob>(new RequestJobObjectId(this.RequestGuid, this.RequestQueueGuid, this.MessageId)))
             {
                 if (transactionalRequestJob != null)
                 {
                     ReportData report = new ReportData(transactionalRequestJob.IdentifyingGuid, transactionalRequestJob.ReportVersion);
                     transactionalRequestJob.RequestJobState          = JobProcessingState.Ready;
                     transactionalRequestJob.MRSServerName            = null;
                     transactionalRequestJob.TimeTracker.CurrentState = this.RelinquishAction(transactionalRequestJob, report);
                     report.Append(MrsStrings.ReportRelinquishingJob);
                     rjProvider.Save(transactionalRequestJob);
                     CommonUtils.CatchKnownExceptions(delegate
                     {
                         report.Flush(rjProvider.SystemMailbox);
                     }, null);
                     transactionalRequestJob.UpdateAsyncNotification(report);
                     this.AfterRelinquishAction();
                 }
             }
         });
     }
 }
Beispiel #2
0
        private void ProcessInvalidJob(TransactionalRequestJob requestJob, RequestJobProvider rjProvider)
        {
            MrsTracer.Service.Warning("MoveJob '{0}' on queue '{1}' failed validation: {2}.", new object[]
            {
                requestJob,
                this.RequestQueueGuid,
                requestJob.ValidationMessage
            });
            if (requestJob.IdleTime < MoveJob.MaxADReplicationWaitTime)
            {
                MrsTracer.Service.Warning("MoveJob '{0}' on queue '{1}' appears invalid.  Waiting for {2} for AD Replication.  Already have waited {3}...", new object[]
                {
                    requestJob,
                    this.RequestQueueGuid,
                    MoveJob.MaxADReplicationWaitTime,
                    requestJob.IdleTime
                });
                return;
            }
            if (requestJob.ValidationResult == RequestJobBase.ValidationResultEnum.Orphaned)
            {
                MrsTracer.Service.Warning("MoveJob '{0}' on queue '{1}' is orphaned, removing it.", new object[]
                {
                    requestJob,
                    this.RequestQueueGuid
                });
                rjProvider.Delete(requestJob);
                CommonUtils.CatchKnownExceptions(delegate
                {
                    ReportData reportData2 = new ReportData(requestJob.IdentifyingGuid, requestJob.ReportVersion);
                    reportData2.Delete(rjProvider.SystemMailbox);
                }, null);
                requestJob.RemoveAsyncNotification();
                MailboxReplicationService.LogEvent(MRSEventLogConstants.Tuple_RemovedOrphanedMoveRequest, new object[]
                {
                    this.RequestQueueGuid.ToString(),
                    this.RequestGuid.ToString(),
                    requestJob.ToString(),
                    requestJob.ValidationMessage
                });
                return;
            }
            ReportData reportData = new ReportData(requestJob.IdentifyingGuid, requestJob.ReportVersion);

            reportData.Append(MrsStrings.ReportFailingInvalidMoveRequest(requestJob.ValidationMessage));
            reportData.Flush(rjProvider.SystemMailbox);
            requestJob.Status      = RequestStatus.Failed;
            requestJob.FailureCode = new int?(-2147024809);
            requestJob.FailureType = "InvalidRequest";
            requestJob.FailureSide = new ExceptionSide?(ExceptionSide.None);
            requestJob.Message     = MrsStrings.MoveRequestMessageError(MrsStrings.MoveRequestDataIsCorrupt(requestJob.ValidationMessage));
            requestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.Failure, new DateTime?(DateTime.UtcNow));
            requestJob.TimeTracker.CurrentState = RequestState.Failed;
            rjProvider.Save(requestJob);
            requestJob.UpdateAsyncNotification(reportData);
            MailboxReplicationService.LogEvent(MRSEventLogConstants.Tuple_FailedInvalidRequest, new object[]
            {
                this.RequestQueueGuid.ToString(),
                this.RequestGuid.ToString(),
                requestJob.ToString(),
                requestJob.ValidationMessage
            });
        }