Exemple #1
0
        public static void addMessageToPoisonQueue(Exception error, lm.Comol.Core.MailCommons.Domain.Messages.Message message, String poisonQueue = "")
        {
            if (String.IsNullOrEmpty(poisonQueue))
            {
                poisonQueue = System.Configuration.ConfigurationManager.AppSettings["PoisonErrorsQueueName"];
            }
            if (null != error && !String.IsNullOrEmpty(poisonQueue))
            {
                MessageQueue poisonMessageQueue = new MessageQueue(poisonQueue);
                if (poisonMessageQueue != null)
                {
                    using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.RequiresNew))
                    {
                        ErrorMessage obj = new ErrorMessage()
                        {
                            Message = message
                        };
                        obj.Error.HelpLink       = error.HelpLink;
                        obj.Error.StackTrace     = error.StackTrace;
                        obj.Error.Source         = error.Source;
                        obj.Error.Message        = error.Message;
                        obj.Error.InnerException = (error.InnerException == null) ? "" : error.InnerException.Message;

                        poisonMessageQueue.Send(obj, MessageQueueTransactionType.Single);
                        txScope.Complete();
                    }
                }
            }
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="message">message </param>
 /// <param name="poisonQueue">queue name</param>
 public static void addMessageToPoisonQueue(lm.Comol.Core.MailCommons.Domain.Messages.Message message, String poisonQueue = "")
 {
     if (String.IsNullOrEmpty(poisonQueue))
     {
         poisonQueue = System.Configuration.ConfigurationManager.AppSettings["PoisonErrorsQueueName"];
     }
     if (null != message && !String.IsNullOrEmpty(poisonQueue))
     {
         MessageQueue poisonMessageQueue = new MessageQueue(poisonQueue);
         if (poisonMessageQueue != null)
         {
             using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.RequiresNew))
             {
                 poisonMessageQueue.Send(message, MessageQueueTransactionType.Single);
                 txScope.Complete();
             }
         }
     }
 }