コード例 #1
0
 /// <summary>
 /// Starts this message queue.
 /// </summary>
 public void Start()
 {
     try
     {
         if (_messageDeliveryThread != null)
         {
             return;
         }
         _wasStarted = false;
         RegisterAtAllMessageChannels();
         _shutdownWatcher = ShutdownWatcher.Create(this);
         _terminatedEvent.Reset();
         Thread thread;
         lock (_syncObj)
             _messageDeliveryThread = thread = new Thread(DoWork)
             {
                 Name = string.Format("AMQ '{0}'", _queueName)
             };
         thread.Start();
     }
     catch (Exception e)
     {
         ServiceRegistration.Get <ILogger>().Error("Unhandled exception in start method of async message queue '{0}'",
                                                   e, _queueName);
     }
 }
コード例 #2
0
 public static ShutdownWatcher Create(AsynchronousMessageQueue owner)
 {
   IMessageBroker broker = ServiceRegistration.Get<IMessageBroker>();
   ShutdownWatcher result = new ShutdownWatcher(owner);
   broker.RegisterMessageReceiver(SystemMessaging.CHANNEL, result);
   return result;
 }
コード例 #3
0
            public static ShutdownWatcher Create(AsynchronousMessageQueue owner)
            {
                IMessageBroker  broker = ServiceRegistration.Get <IMessageBroker>();
                ShutdownWatcher result = new ShutdownWatcher(owner);

                broker.RegisterMessageReceiver(SystemMessaging.CHANNEL, result);
                return(result);
            }
コード例 #4
0
 /// <summary>
 /// Terminates this message queue. Once the queue is terminated, no further messages are delivered.
 /// But as this method runs asynchronously to the message delivery thread, it is possible that a message is still being
 /// delivered when this method returns.
 /// </summary>
 /// <remarks>
 /// This method requests its internal lock, so it must not be called while holding other locks, according to the
 /// MP2 multithreading guidelines.
 /// </remarks>
 public void Terminate()
 {
     if (_shutdownWatcher != null)
     {
         _shutdownWatcher.Remove();
     }
     _shutdownWatcher = null;
     UnregisterFromAllMessageChannels();
     _terminatedEvent.Set();
 }
コード例 #5
0
 /// <summary>
 /// Terminates this message queue. Once the queue is terminated, no further messages are delivered.
 /// But as this method runs asynchronously to the message delivery thread, it is possible that a message is still being
 /// delivered when this method returns.
 /// </summary>
 /// <remarks>
 /// This method requests its internal lock, so it must not be called while holding other locks, according to the
 /// MP2 multithreading guidelines.
 /// A message queue which was terminated by this method may be restarted by calling <see cref="Start"/> again.
 /// </remarks>
 public void Terminate()
 {
     if (_shutdownWatcher != null)
     {
         _shutdownWatcher.Remove();
     }
     _shutdownWatcher = null;
     UnregisterFromAllMessageChannels();
     if (!_terminatedEvent.SafeWaitHandle.IsClosed)
     {
         _terminatedEvent.Set();
     }
 }
コード例 #6
0
        /// <summary>
        /// Starts this message queue.
        /// </summary>
        public void Start()
        {
            if (_messageDeliveryThread != null)
            {
                return;
            }
            RegisterAtAllMessageChannels();
            _shutdownWatcher = ShutdownWatcher.Create(this);
            _terminatedEvent.Reset();
            Thread thread;

            lock (_syncObj)
                _messageDeliveryThread = thread = new Thread(DoWork)
                {
                    Name = string.Format("AMQ '{0}'", _queueName)
                };
            thread.Start();
        }
コード例 #7
0
 /// <summary>
 /// Terminates this message queue. Once the queue is terminated, no further messages are delivered.
 /// But as this method runs asynchronously to the message delivery thread, it is possible that a message is still being
 /// delivered when this method returns.
 /// </summary>
 /// <remarks>
 /// This method requests its internal lock, so it must not be called while holding other locks, according to the
 /// MP2 multithreading guidelines.
 /// A message queue which was terminated by this method may be restarted by calling <see cref="Start"/> again.
 /// </remarks>
 public void Terminate()
 {
   if (_shutdownWatcher != null)
     _shutdownWatcher.Remove();
   _shutdownWatcher = null;
   UnregisterFromAllMessageChannels();
   if (!_terminatedEvent.SafeWaitHandle.IsClosed)
     _terminatedEvent.Set();
 }
コード例 #8
0
 /// <summary>
 /// Starts this message queue.
 /// </summary>
 public void Start()
 {
   if (_messageDeliveryThread != null)
     return;
   RegisterAtAllMessageChannels();
   _shutdownWatcher = ShutdownWatcher.Create(this);
   _terminatedEvent.Reset();
   Thread thread;
   lock (_syncObj)
     _messageDeliveryThread = thread = new Thread(DoWork)
       {
           Name = string.Format("AMQ '{0}'", _queueName)
       };
   thread.Start();
 }
コード例 #9
0
 /// <summary>
 /// Terminates this message queue. Once the queue is terminated, no further messages are delivered.
 /// But as this method runs asynchronously to the message delivery thread, it is possible that a message is still being
 /// delivered when this method returns.
 /// </summary>
 /// <remarks>
 /// This method requests its internal lock, so it must not be called while holding other locks, according to the
 /// MP2 multithreading guidelines.
 /// A message queue which was terminated by this method may be restarted by calling <see cref="Start"/> again.
 /// </remarks>
 public void Terminate()
 {
   if (_shutdownWatcher != null)
     _shutdownWatcher.Remove();
   _shutdownWatcher = null;
   UnregisterFromAllMessageChannels();
   _terminatedEvent.Set();
 }