示例#1
0
文件: ServiceImpl.cs 项目: yaq/yaq
        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();
            }
        }
示例#2
0
文件: ServiceImpl.cs 项目: yaq/yaq
        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();
            }
        }