コード例 #1
0
        public IEnumerable <DocumentMessageEnvelope> WaitForMessages(TimeSpan duration)
        {
            var timeout = DateTime.UtcNow + duration;
            DocumentMessageEnvelope reserved = null;

            while (DateTime.UtcNow < timeout && null == reserved)
            {
                reserved = MaybeReserveOne();
                if (null == reserved)
                {
                    Thread.Sleep(CheckSpan);
                }
            }

            var retval = new List <DocumentMessageEnvelope>();

            while (null != reserved)
            {
                retval.Add(reserved);
                reserved = MaybeReserveOne();
            }

            if (!retval.Any() || (_rnd.Next(100) < 10))
            {
                DoHouseCleaning();
            }

            return(retval);
        }
コード例 #2
0
 public RavenQueueAcknowledge(DocumentMessageEnvelope message)
 {
     _message = message;
 }