public void Configure(IThrottlingConfig config) { ArgumentValidator.ThrowIfNull("config", config); if (!config.MailboxDeliveryThrottlingEnabled || !config.ThrottlingLogEnabled || config.ThrottlingLogPath == null || string.IsNullOrEmpty(config.ThrottlingLogPath.PathName)) { this.enabled = false; return; } DeliveryThrottlingLog.logSchema = new LogSchema("Microsoft Mailbox Transport Server", Assembly.GetExecutingAssembly().GetName().Version.ToString(), "Mailbox Transport Delivery Throttling Log", DeliveryThrottlingLog.fields); this.asyncLog = new AsyncLog("DeliveryThrottling", new LogHeaderFormatter(DeliveryThrottlingLog.logSchema), "DeliveryThrottling"); this.asyncLog.Configure(config.ThrottlingLogPath.PathName, config.ThrottlingLogMaxAge, (long)(config.ThrottlingLogMaxDirectorySize.IsUnlimited ? 0UL : config.ThrottlingLogMaxDirectorySize.Value.ToBytes()), (long)(config.ThrottlingLogMaxFileSize.IsUnlimited ? 0UL : config.ThrottlingLogMaxFileSize.Value.ToBytes()), config.ThrottlingLogBufferSize, config.ThrottlingLogFlushInterval, config.AsyncLogInterval); this.enabled = true; this.summaryLogTimer = new GuardedTimer(new TimerCallback(this.SummaryLogWorker), null, config.ThrottlingSummaryLoggingInterval, config.ThrottlingSummaryLoggingInterval); this.LogReset(); }
internal DeliveryThrottling(GetMDBThreadLimitAndHealth getMDBThreadLimitAndHealth, IThrottlingConfig throttlingConfig, IDeliveryThrottlingLogWorker throttlingLogWorker) { this.getMDBThreadLimitAndHealth = getMDBThreadLimitAndHealth; this.deliveryThrottlingLog = new DeliveryThrottlingLog(); this.deliveryThrottlingLog.Configure(throttlingConfig ?? DeliveryConfiguration.Instance.Throttling); this.deliveryThrottlingLogWorker = (throttlingLogWorker ?? new DeliveryThrottlingLogWorker(this.deliveryThrottlingLog)); }