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); }
public RavenQueueAcknowledge(DocumentMessageEnvelope message) { _message = message; }