示例#1
0
        public static void Test()
        {
            var queue = new Msmq();

            queue.Createqueue(".\\Private$\\myQueue1");
            queue.SendMessage("msg 1 named tom!");
            queue.SendMessage("msg 2 named jerry!");
            queue.PeekMessage();
            queue.PeekMessage();
            queue.ReceiveMessage();
            queue.GetAllMessage();
            queue.ReceiveMessage();
            queue.ReceiveMessage();
            queue.PeekMessage();
            queue.ClealMessage();
        }
示例#2
0
        public static void Test2()
        {
            var queue = new Msmq();

            queue.Createqueue(".\\Private$\\myQueue1");

            int num = 0;

            while (true)
            {
                queue.SendMessage(string.Format("msg {0}", num++));
                var key = Console.ReadLine();
                if (key == "exit")
                {
                    break;
                }
            }
        }