/// <summary> /// Puts a message into the message queue /// </summary> /// <param name="o">Object to send</param> public void SendMessage(object o) { try { MQ.Send(o); } catch (Exception e) { } }
public void AddQProcess(string refNum) { try { if (MessageQueue.Exists(@".\Private$\ScrapeSessionsQueue")) { MQ = new System.Messaging.MessageQueue(@".\Private$\ScrapeSessionsQueue"); MQ.SetPermissions("Everyone", MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow); } else { log.LogMessage(Enumeration.LoggingPriority.Low, refNum, "Creating MS message queue with name: " + @".\Private$\ScrapeSessionsQueue"); MQ = MessageQueue.Create(@".\Private$\ScrapeSessionsQueue"); MQ.SetPermissions("Everyone", MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow); } ScrapeSession session = new ScrapeSession { AccountPassword = scrapeSession.AccountPassword, AccountUsername = scrapeSession.AccountUsername, ReferenceNumber = refNum, Rules = scrapeSession.Rules, ScrapeURL = scrapeSession.ScrapeURL }; MQ.Send(session); } catch (MessageQueueException mqEx) { log.LogMessage(Enumeration.LoggingPriority.High, refNum, mqEx); } catch (Exception ex) { log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex); } }