Beispiel #1
0
        // Provides an event handler for the ReceiveCompleted event.
        private static void MsgReceiveCompleted(IAsyncResult asyncResult)
        {
            // Connect to the queue.
            McQueue queue = McQueue.Create(qnmae);

            // End the asynchronous receive operation.
            IQueueItem item = queue.EndReceive(asyncResult);

            Console.WriteLine("Message received: {0}", item.ItemId);
            TransWorker(item);
        }
Beispiel #2
0
        static void q_DequeueCompleted(object sender, ReceiveCompletedEventArgs e)
        {
            // Connect to the queue.
            McQueue mq = (McQueue)sender;

            // End the asynchronous receive operation.
            IQueueItem item = mq.EndReceive(e.AsyncResult);

            Console.WriteLine(item.ItemId.ToString());
            TransWorker(item);

            //count += 1;
            //if (count == 10)
            //{
            //    signal.Set();
            //}
            //signal.Set();
            // Restart the asynchronous receive operation.
            //mq.BeginReceive();
        }