Example #1
0
        protected override void PrepareToRun()
        {
            _eventMonitorThread = new RFWorkDoneMonitorMSMQ(_eventQueue, _context, _instructionSink, _eventSink);
            _eventMonitorThread.StartThread();

            // create worker threads
            // TODO: move starting these out of here (and out of process) one day
            _workerThreads = new List <RFWorkerThreadMSMQ>();
            var msmqSink = new RFEventSinkMSMQ(_eventQueue); // has remote proxies for sending back events

            for (int i = 0; i < _workerThreadsCount; i++)
            {
                var t = new RFWorkerThreadMSMQ(_context, "FormatName:" + _workerQueue.FormatName, msmqSink);
                t.StartThread();
                _workerThreads.Add(t);
            }
        }
Example #2
0
 protected override void PrepareToStop()
 {
     if (_eventMonitorThread != null)
     {
         _eventMonitorThread.Shutdown();
         _eventMonitorThread = null;
     }
     if (_workerThreads != null)
     {
         foreach (var t in _workerThreads)
         {
             t.Shutdown();
         }
         _workerThreads = null;
     }
     if (_eventQueue != null)
     {
         try
         {
             RFStatic.Log.Debug(typeof(RFDispatchQueueMonitorMSMQ), "Deleting MSMQ queue {0}", _eventQueue.Path);
             MessageQueue.Delete(_eventQueue.Path);
         }
         catch (Exception ex)
         {
             Log.Exception(this, ex, "Error deleting MSMQ queue {0}", _eventQueue.Path);
         }
         _eventQueue = null;
     }
     if (_workerQueue != null)
     {
         try
         {
             RFStatic.Log.Debug(typeof(RFDispatchQueueMonitorMSMQ), "Deleting MSMQ queue {0}", _workerQueue.Path);
             MessageQueue.Delete(_workerQueue.Path);
         }
         catch (Exception ex)
         {
             Log.Exception(this, ex, "Error deleting MSMQ queue {0}", _workerQueue.Path);
         }
         _workerQueue = null;
     }
 }