Exemple #1
0
        static void ReceiveSessionMessages(MessageSession receiver)
        {
            // Read messages from queue until queue is empty:
            Console.WriteLine("Reading messages from queue {0}", receiver.Path);
            Console.WriteLine("Receiver Type:" + receiver.GetType().Name);
            Console.WriteLine("Receiver.SessionId = " + receiver.SessionId);

            BrokeredMessage receivedMessage;

            while ((receivedMessage = receiver.Receive(TimeSpan.FromSeconds(receiveSessionMessageTimeout))) != null)
            {
                string sessionId = receiver.SessionId;
                ProcessMessage(receivedMessage, receiver);
            }

            receiver.Close();
        }