protected void InitReceiver(string mqPath) { _MQAgent = MSMQAgent.GetMSMQAgent(mqPath); 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() { 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); }