private void InitServiceQueue() { // create the message queue try { // check to make sure the message queue does not exist already if (!MessageQueue.Exists (mServiceQueuePath)) { // create the new message queue and make it transactional mServiceQueue = MessageQueue.Create(mServiceQueuePath); mServiceQueue.Close(); } else { mServiceQueue = new MessageQueue(mServiceQueuePath); }
Type[] types = new Type[1]; types[0] = typeof(string); mServiceQueue.Formatter = new XmlMessageFormatter(types); mServiceQueue.ReceiveCompleted += new ReceiveCompletedEventHandler(MessageListenerEventHandler);
// Begin the asynchronous receive operation. mServiceQueue.BeginReceive(); mServiceQueue.Close(); } // show message if we used an invalid message queue name; catch (MessageQueueException MQException) { Console.WriteLine (MQException.Message); } return; } }
private void InitServiceQueue() { // create the message queue try { // check to make sure the message queue does not exist already if (!MessageQueue.Exists (mServiceQueuePath)) { // create the new message queue and make it transactional mServiceQueue = MessageQueue.Create(mServiceQueuePath); mServiceQueue.Close(); } else { mServiceQueue = new MessageQueue(mServiceQueuePath); }
Type[] types = new Type[1]; types[0] = typeof(string); mServiceQueue.Formatter = new XmlMessageFormatter(types); mServiceQueue.ReceiveCompleted += new ReceiveCompletedEventHandler(MessageListenerEventHandler);
// Begin the asynchronous receive operation. mServiceQueue.BeginReceive(); mServiceQueue.Close(); } // show message if we used an invalid message queue name; catch (MessageQueueException MQException) { Console.WriteLine (MQException.Message); } return; } }