/// <summary>
        ///  Create the transacted MSMQ queue if necessary.
        /// </summary>
        /// <param name="queuePath"></param>
        void CreateQueue(string queuePath)
        {
            try
            {
                if (!MessageQueue.Exists(queuePath))
                {
                    MessageQueue.Create(queuePath, true);

                    // Create a new trustee to represent the "system" user group.
                    Trustee tr = new Trustee("SYSTEM");
                    MessageQueueAccessControlEntry entry = new MessageQueueAccessControlEntry(tr, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
                    // Apply the MessageQueueAccessControlEntry to the queue.
                    SysEventQueue.SetPermissions(entry);

                    if (!string.IsNullOrEmpty(Properties.Settings.Default.AdministratorGroupName))
                    {
                        tr    = new Trustee(Properties.Settings.Default.AdministratorGroupName);
                        entry = new MessageQueueAccessControlEntry(tr, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
                        SysEventQueue.SetPermissions(entry);
                    }
                }
            }
            catch (MessageQueueException ex)
            {
                ReceivedInfoProc.LogError(ex);
            }
        }
Example #2
0
 public void SubmitMessage_Queue(byte[] message, DateTime time)
 {
     try
     {
         ReceivedInfoProc.Process(message, time);
     }
     catch (Exception ex)
     {
         ReceivedInfoProc.LogError(ex);
     }
 }
 /// <summary>
 /// Comienza a leer la cola de manera asincrona
 /// </summary>
 public void StartResivePoisonedMessage()
 {
     try
     {
         _SystemEventPoison = new SystemEventPoison();
         _SystemEventPoison.StartService();
         _SystemEventPoison.OnLogEvent += new EventHandler(SystemEvent_OnLogEvent);
     }
     catch (Exception ex)
     {
         ReceivedInfoProc.LogError(ex);
     }
 }
Example #4
0
 /// <summary>
 /// Comienza a leer la cola de manera asincrona
 /// </summary>
 public void StartResiveMessage()
 {
     try
     {
         SystemEvent.parentComponent = this;
         _SystemEvent             = new SystemEvent();
         _SystemEvent.OnLogEvent += new EventHandler(SystemEvent_OnLogEvent);
         _SystemEvent.StartService();
     }
     catch (Exception ex)
     {
         ReceivedInfoProc.LogError(ex);
     }
 }
Example #5
0
        public void SubmitMessage_Queue(byte[] message, DateTime time)
        {
            int randomNumber = r.Next(10);

            if (randomNumber % 2 == 0)
            {
                try
                {
                    ReceivedInfoProc.Process(message, time);
                }
                catch (Exception ex)
                {
                    ReceivedInfoProc.LogError(ex);
                }
            }
            else
            {
                SysEventMessage m = ReceivedInfoProc.GetSysEventMessage(message);
                Log("Abortando transaccion, Evento con problema : " + m.IdEvent);

                throw new Exception("No se puede procesar el evento: " + m.IdEvent);
            }
        }