Example #1
0
        private void CleanupCompletedJob(TransactionalRequestJob requestJob, RequestJobProvider rjProvider)
        {
            DateTime t = requestJob.TimeTracker.GetTimestamp(RequestJobTimestamp.DoNotPickUntil) ?? DateTime.MaxValue;

            if (DateTime.UtcNow < t)
            {
                return;
            }
            MrsTracer.Service.Debug("Cleaning up expired completed job '{0}' on queue '{1}'", new object[]
            {
                requestJob,
                this.RequestQueueGuid
            });
            rjProvider.Delete(requestJob);
            CommonUtils.CatchKnownExceptions(delegate
            {
                ReportData reportData = new ReportData(requestJob.IdentifyingGuid, requestJob.ReportVersion);
                reportData.Delete(rjProvider.SystemMailbox);
            }, null);
            CommonUtils.CatchKnownExceptions(delegate
            {
                rjProvider.DeleteIndexEntries(requestJob);
            }, null);
            requestJob.RemoveAsyncNotification();
            MailboxReplicationService.LogEvent(MRSEventLogConstants.Tuple_RemovedCompletedRequest, new object[]
            {
                requestJob.ToString(),
                this.RequestGuid.ToString(),
                requestJob.WorkItemQueueMdbName
            });
        }
Example #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
            });
        }