protected void InitReceiver(string agentName, string busName)
        {
            _MQAgent = MSMQAgent.GetMSMQAgent(agentName, busName);

            if (_MQAgent == null || _MQAgent.GetQueue() == null)
            {
                throw new Exception("Init receiver failed.");
            }

            if (_MQAgent.GetQueue() == null)
            {
                throw new Exception("Init receiver's queue failed.");
            }
        }
        public bool StartReceiver()
        {
            //mq.CreateMQ();
            MessageQueue myQueue = null;
            bool         result  = false;

            try
            {
                myQueue = _MQAgent.GetQueue();
                if (myQueue == null)
                {
                    return(result);
                }
                //异步
                myQueue.PeekCompleted += new PeekCompletedEventHandler(PeekCompleted);
                myQueue.BeginPeek();
                result = true;
            }
            catch { }
            finally { }
            return(result);
        }