protected virtual void MsgDispatchLoop()

in src/main/csharp/MessageConsumer.cs [228:273]


		protected virtual void MsgDispatchLoop()
		{
			Tracer.InfoFormat("Starting dispatcher thread consumer: {0}", this.asyncDeliveryThread.Name);
			TimeSpan receiveWait = TimeSpan.FromSeconds(2);

			this.destination.InitReceiver();
			// Signal that this thread has started.
			asyncInit = true;

			while(asyncDelivery)
			{
				try
				{
					IMessage message = Receive(receiveWait);

					if(asyncDelivery)
					{
						if(null != message)
						{
							try
							{
								listener(message);
							}
							catch(Exception ex)
							{
								HandleAsyncException(ex);
							}
						}
						else
						{
							Thread.Sleep(1);
						}
					}
				}
				catch(ThreadAbortException ex)
				{
					Tracer.InfoFormat("Thread abort received in thread: {0} : {1}", this, ex.Message);
					break;
				}
				catch(Exception ex)
				{
					Tracer.ErrorFormat("Exception while receiving message in thread: {0} : {1}", this, ex.Message);
				}
			}
			Tracer.InfoFormat("Stopped dispatcher thread consumer: {0}", this.asyncDeliveryThread.Name);
		}