SenseNet.Messaging.NotificationSender.StartMessageProcessing C# (CSharp) Method

StartMessageProcessing() public static method

public static StartMessageProcessing ( ) : void
return void
        public static void StartMessageProcessing()
        {
            if (!_isSmtpConfigured && !TestMode)
            {
                Debug.WriteLine("#Notification> Notification sender is unable to work. Reason: smtp server isn't configured.");
                Logger.WriteError("Notification sender is unable to work. Reason: smtp server isn't configured.");
                return;
            }
            
            if (_mailSendingInProgress)
                return;

            _mailSendingInProgress = true;
            Debug.WriteLine("#Notification> _mailSendingInProgress true ");
            
            var worker = new Thread(ProcessQueuedMessages);
            worker.Name = "NotificationSenderThread";
            worker.CurrentCulture = Thread.CurrentThread.CurrentCulture;
            worker.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
            worker.Start();
        }

Usage Example

Exemplo n.º 1
0
 internal static void TimerTick(DateTime now)
 {
     if (AcquireLock(LockingTimeframe))
     {
         try
         {
             Debug.WriteLine("#Notification> ** lock recieved");
             _processing = true;
             TimerTick(now, NotificationFrequency.Immediately);
             TimerTick(now, NotificationFrequency.Daily);
             TimerTick(now, NotificationFrequency.Weekly);
             TimerTick(now, NotificationFrequency.Monthly);
         }
         catch (Exception ex)
         {
             Logger.WriteException(ex);
         }
         finally
         {
             _processing = false;
             ReleaseLock();
             NotificationSender.StartMessageProcessing();
         }
     }
     else
     {
         Debug.WriteLine("#Notification> ** couldn't get lock");
     }
 }