Ejemplo n.º 1
0
        public static InvokeArgs Create(StoreSession storeSession, TimeSpan timePerTask, MailboxData mailboxData)
        {
            InvokeArgs invokeArgs = InvokeArgs.Create(storeSession, mailboxData);

            invokeArgs.TimePerTask = timePerTask;
            MailboxDataForDemandJob mailboxDataForDemandJob = mailboxData as MailboxDataForDemandJob;

            if (mailboxDataForDemandJob != null)
            {
                invokeArgs.Parameters = mailboxDataForDemandJob.Parameters;
            }
            return(invokeArgs);
        }
Ejemplo n.º 2
0
        private AssistantTaskContext ProcessAdminRpcMailboxUnderPoisonControl(AssistantTaskContext context, EmergencyKit kit)
        {
            TimeBasedDatabaseJob.processMailboxTestHook.Value();
            AssistantTaskContext result = null;
            Guid activityId             = (ActivityContext.ActivityId != null) ? ActivityContext.ActivityId.Value : Guid.Empty;

            if (context.Args == null)
            {
                context.Args = InvokeArgs.Create(null, this.Driver.TimePerTask, context.MailboxData);
            }
            AssistantsLog.LogStartProcessingMailboxEvent(activityId, this.Assistant as AssistantBase, context.MailboxData.MailboxGuid, context.MailboxData.DisplayName, this);
            try
            {
                kit.SetContext(this.Assistant, context.MailboxData);
                result = context.Step(context);
            }
            finally
            {
                kit.UnsetContext();
            }
            AssistantsLog.LogEndProcessingMailboxEvent(activityId, this.Assistant as AssistantBase, context.CustomDataToLog, context.MailboxData.MailboxGuid, context.MailboxData.DisplayName, this);
            return(result);
        }
Ejemplo n.º 3
0
        private AssistantTaskContext ProcessStoreMailbox(AssistantTaskContext context, EmergencyKit kit)
        {
            TimeBasedDatabaseJob.processMailboxTestHook.Value();
            StoreMailboxData     storeMailboxData = context.MailboxData as StoreMailboxData;
            AssistantTaskContext assistantTaskContext;

            using (StoreSession storeSession = this.OpenMailboxSession(storeMailboxData))
            {
                Stopwatch stopwatch = Stopwatch.StartNew();
                try
                {
                    if (context.Args == null)
                    {
                        context.Args = InvokeArgs.Create(storeSession, this.Driver.TimePerTask, storeMailboxData);
                    }
                    kit.SetContext(this.Assistant, storeMailboxData);
                    assistantTaskContext = context.Step(context);
                }
                finally
                {
                    kit.UnsetContext();
                    if (this.Driver.AssistantType.ControlDataPropertyDefinition != null && context.Args != null)
                    {
                        context.Args.StoreSession.Mailbox[this.Driver.AssistantType.ControlDataPropertyDefinition] = ControlData.Create(DateTime.UtcNow).ToByteArray();
                        context.Args.StoreSession.Mailbox.Save();
                    }
                }
                stopwatch.Stop();
                this.performanceCounters.AverageMailboxProcessingTime.IncrementBy(stopwatch.ElapsedTicks);
                this.performanceCounters.AverageMailboxProcessingTimeBase.Increment();
                if (assistantTaskContext == null)
                {
                    this.performanceCounters.MailboxesProcessed.Increment();
                }
            }
            return(assistantTaskContext);
        }
Ejemplo n.º 4
0
        public static InvokeArgs Create(StoreSession storeSession)
        {
            StoreMailboxData storeMailboxData = new StoreMailboxData(storeSession.MailboxGuid, storeSession.MdbGuid, storeSession.DisplayAddress, null);

            return(InvokeArgs.Create(storeSession, storeMailboxData));
        }