public Message[] GetMessages(string queueName, int numberOfMessages, TimeSpan visibilityTimeout) { Utils.Initialize(); using (var dc = new Data.MessageDataContext()) { var now = DateTime.UtcNow; var qry = dc.ExecuteQuery<Data.Message>(Utils.GetMessageSql, numberOfMessages, Guid.NewGuid(), now + visibilityTimeout, now, queueName); return qry.Select(m => m.ToMessage()).ToArray(); } }
public Message[] PeekMessages(string queueName, int numberOfMessages) { Utils.Initialize(); using (var dc = new Data.MessageDataContext()) { var qry = dc.ExecuteQuery<Data.Message>(Utils.PeekMessageSql, numberOfMessages, queueName); return qry.Select(m => m.ToMessage()).Select(m => { m.PopReceipt = null; return m; }).ToArray(); } }