Пример #1
0
 // Used as "pre-final-2" stage to prepare containerFactory, memberTag and usercontext
 private AdminkaRoutineHandlerBaseAsync(
     ApplicationSettings applicationSettings,
     IPerformanceCounters performanceCounters,
     Func <Exception, Guid, MemberTag, /*Func<Exception, string>, */ Exception> routineTransformException,
     Func <Guid, MemberTag, IMemberLogger> composeLoggers,
     IContainer container,
     Guid correaltionToken,
     MemberTag memberTag,
     TUserContext userContext,
     bool hasVerboseLoggingPrivilege,
     Func <TUserContext, string> getAuditStamp,
     object input
     ) : this(
         applicationSettings,
         new AdminkaRoutineHandlerFactory <TUserContext>(correaltionToken,
                                                         routineTransformException,
                                                         composeLoggers,
                                                         performanceCounters),
         container,
         memberTag,
         userContext,
         hasVerboseLoggingPrivilege,
         getAuditStamp,
         input)
 {
 }
Пример #2
0
 // used by wcf and test (predefined UserContext with its own transformException)
 public AdminkaRoutineHandlerBaseAsync(
     ApplicationSettings applicationSettings,
     IPerformanceCounters performanceCounters,
     IConfigurationContainerFactory configurationFactory,
     Func <Exception, Guid, MemberTag, /* Func<Exception, string>,*/ Exception> routineTransformException,
     Guid correlationToken,
     ITraceDocumentBuilder documentBuilder,
     MemberTag memberTag,
     TUserContext userContext,
     bool hasVerboseLoggingPrivilege,
     string configurationFor,
     Func <TUserContext, string> getAuditStamp,
     object input
     ) : this(
         applicationSettings,
         performanceCounters,
         routineTransformException,
         InjectedManager.ComposeNLogMemberLoggerFactory(documentBuilder),
         InjectedManager.CreateContainerFactory(configurationFactory).CreateContainer(memberTag, configurationFor),
         correlationToken,
         memberTag,
         userContext,
         hasVerboseLoggingPrivilege,
         getAuditStamp,
         input)
 {
 }
Пример #3
0
 public AdminkaAnonymousRoutineHandlerAsync(
     ApplicationSettings applicationSettings,
     IPerformanceCounters performanceCounters,
     IConfigurationContainerFactory configurationContainerFactory,
     Func <Exception, Guid, MemberTag, /*Func<Exception, string>,*/ Exception> transformException,
     Guid correlationToken,
     ITraceDocumentBuilder documentBuilder,
     MemberTag memberTag,
     AnonymousUserContext anonymousUserContext,
     object input
     ) : base(
         applicationSettings,
         performanceCounters,
         configurationContainerFactory,
         transformException,
         correlationToken,
         documentBuilder,
         memberTag,
         anonymousUserContext,
         false, //getVerboseLoggingFlag: (userContext) => "VerboseLogging", // (userContext) => (userContext?.User?.HasPrivilege(Privilege.VerboseLogging) ?? false) ? Privilege.VerboseLogging : null
         configurationFor: anonymousUserContext.AuditStamp,
         u => u.AuditStamp,
         input
         )
 {
 }
Пример #4
0
 public AdminkaRoutineHandlerFactory(
     Guid correlationToken,
     Func <Exception, Guid, MemberTag, /*Func<Exception, string>,*/ Exception> routineTransformException,
     Func <Guid, MemberTag, IMemberLogger> composeLoggers,
     IPerformanceCounters performanceCounters
     ) : base(correlationToken)
 {
     this.composeLoggers            = composeLoggers;
     this.routineTransformException = routineTransformException;
     this.performanceCounters       = performanceCounters;
 }
Пример #5
0
 void RegisterPropertyChanged(IPerformanceCounters counter)
 {
     counter.PropertyChanged += OnPerfCounterPropertyChanged;
 }
Пример #6
0
 public PerfMonitorFormPresenter(IPerformanceCounters counters)
 {
     _counters = counters;
 }
 public PerfMonitorFormPresenter( IPerformanceCounters counters )
 {
     _counters = counters;
 }
 public SystemPerformanceCounters([NotNull] IPerformanceCounters performanceCounters, [NotNull] IApplicationLifetimeManager applicationLifetimeManager)
 {
     _PerformanceCounters        = performanceCounters ?? throw new ArgumentNullException(nameof(performanceCounters));
     _ApplicationLifetimeManager = applicationLifetimeManager ?? throw new ArgumentNullException(nameof(applicationLifetimeManager));
 }
Пример #9
0
        internal void ProcessSentItemWrapperMessage(EmailMessage message, string mdbGuid, MessageItem replayItem, IStoreOperations storeOperations, IAgentInfoWriter agentInfo)
        {
            if (!this.IsSharedMailboxSentItemMessage(message, agentInfo))
            {
                return;
            }
            IPerformanceCounters counterInstance = this.perfCountersFactory.GetCounterInstance(mdbGuid);
            bool flag = true;

            try
            {
                MessageItem attachedMessageItem = this.GetAttachedMessageItem(replayItem, agentInfo);
                if (attachedMessageItem == null)
                {
                    this.logger.TraceDebug(new string[]
                    {
                        "SharedMailboxSentItemsAgent.OnPromotedMessageHandler: Message has the correct header tags but does not contain the original email attachment"
                    });
                }
                else
                {
                    string text = attachedMessageItem.TryGetProperty(ItemSchema.InternetMessageId) as string;
                    if (text != null && storeOperations.MessageExistsInSentItems(text))
                    {
                        this.logger.TraceDebug(new string[]
                        {
                            "SharedMailboxSentItemsAgent.OnPromotedMessageHandler: message already exits in the sent items folder. Don't have to copy."
                        });
                    }
                    else
                    {
                        this.logger.TraceDebug(new string[]
                        {
                            "SharedMailboxSentItemsAgent.OnPromotedMessageHandler: Get the sent items folder Id."
                        });
                        storeOperations.CopyAttachmentToSentItemsFolder(attachedMessageItem);
                        this.UpdateAverageSentItemCopyTimePerfCounter(attachedMessageItem, counterInstance);
                        counterInstance.IncrementSentItemsMessages();
                    }
                }
            }
            catch (StorageTransientException ex)
            {
                flag = false;
                counterInstance.IncrementErrors();
                this.logger.TraceDebug(new string[]
                {
                    "SharedMailboxSentItemsAgent.OnPromotedMessageHandler encountered an exception: ",
                    ex.ToString()
                });
                this.logger.LogEvent(MailboxTransportEventLogConstants.Tuple_SharedMailboxSentItemsAgentException, ex);
                throw new SmtpResponseException(SharedMailboxSentItemsAgent.CopyFailedTransientError);
            }
            catch (Exception ex2)
            {
                flag = false;
                counterInstance.IncrementErrors();
                if (ex2 is OutOfMemoryException || ex2 is StackOverflowException || ex2 is ThreadAbortException)
                {
                    throw;
                }
                this.logger.TraceDebug(new string[]
                {
                    "SharedMailboxSentItemsAgent.OnPromotedMessageHandler encountered an exception:",
                    ex2.ToString()
                });
                this.logger.LogEvent(MailboxTransportEventLogConstants.Tuple_SharedMailboxSentItemsAgentException, ex2);
                throw new SmtpResponseException(SharedMailboxSentItemsAgent.CopyFailedPermanentError);
            }
            finally
            {
                if (flag)
                {
                    this.logger.TraceDebug(new string[]
                    {
                        "SharedMailboxSentItemsAgent.OnPromotedMessageHandler: Copy operation complete. Going to raise success exception to inform delivery service to drop this message."
                    });
                    throw new SmtpResponseException(SharedMailboxSentItemsAgent.SharedMailboxSentItemCopySuccess, "SharedMailboxSentItemsAgent");
                }
            }
        }
Пример #10
0
        private void UpdateAverageSentItemCopyTimePerfCounter(Item attachedMessageItem, IPerformanceCounters performanceCounter)
        {
            ExDateTime?exDateTime = attachedMessageItem.TryGetProperty(ItemSchema.SentTime) as ExDateTime?;

            if (exDateTime != null)
            {
                this.logger.TraceDebug(new string[]
                {
                    "SharedMailboxSentItemsAgent.OnPromotedMessageHandler: Updating the average delivery time for for the message copy."
                });
                TimeSpan timeSpan = DateTime.UtcNow - exDateTime.Value.UniversalTime;
                performanceCounter.UpdateAverageMessageCopyTime(timeSpan);
                this.logger.TraceDebug(new string[]
                {
                    "SharedMailboxSentItemsAgent.OnPromotedMessageHandler: Message delivery time is:" + timeSpan
                });
            }
        }