示例#1
0
        internal Task DeleteDeadletterAsync(RedisDeadletter <T> deadletter)
        {
            var deadletterQueueName = RedisQueueConventions.GetDeadLetterQueueName(_queueName);
            var hash = RedisQueueConventions.GetMessageHashKey(_queueName, deadletter.Message.Id);

            return(Task.WhenAll(_db.KeyDeleteAsync(hash), _db.ListRemoveAsync(deadletterQueueName, _serializer.Serialize(deadletter.Message), -1)));
        }
示例#2
0
        internal async IAsyncEnumerable <RedisDeadletter <T> > PeekDeadlettersAsync(int limit)
        {
            if (limit >= 1)
            {
                limit--;             //0 is the first element of the list, thus 0 will return 1
            }
            var values = await _db.ListRangeAsync(RedisQueueConventions.GetDeadLetterQueueName(_queueName), 0, limit).ConfigureAwait(false);

            foreach (byte[] value in values)
            {
                var deadletter = new RedisDeadletter <T> {
                    Message = _serializer.Deserialize <RedisListItem <T> >(value.AsSpan())
                };
                var hash   = RedisQueueConventions.GetMessageHashKey(_queueName, deadletter.Message.Id);
                var hashes = await _db.HashGetAllAsync(hash).ConfigureAwait(false);

                deadletter.HashEntries = hashes.ToStringDictionary();
                yield return(deadletter);
            }
        }
示例#3
0
        public Task DeleteDeadletterAsync <T>(RedisDeadletter <T> deadletter) where T : class, IRedisMessage
        {
            var queueClient = new RedisQueueClient <T>(_db);

            return(queueClient.DeleteDeadletterAsync(deadletter));
        }