Beispiel #1
0
        protected override void OnMessageReceived(QueueItemEventArgs e)
        {
            base.OnMessageReceived(e);
            IQueueItem item = e.Item;

            if (item == null)
            {
                return;
            }

            if (e.State == ItemState.Dequeue)
            {
                base.CommitTrans(item.ItemId, item.HasAttach);
            }
            Console.WriteLine("Queue{0} Items count: {1}", QueueName, base.Count);
            if (item != null)
            {
                Console.WriteLine("Queue{0} MessageReceived: {1}, Duration:{2}", QueueName, item.ItemId, item.Duration());
            }
            else
            {
                Console.WriteLine("Queue{0} Receive timeout", QueueName);
            }

            Netlog.InfoFormat("OnMessageReceived:{0} Received:{1}", e.Item.MessageId, e.Item.SentTime);

            if (base.Count <= 0)
            {
                TimeSpan ts = DateTime.Now.Subtract(start);
                Console.WriteLine("Time took:{0}", ts.TotalSeconds);
            }
        }