public async Task <IMessageTransaction> Receive(TimeSpan?timeout = null) { var redis = this.connection.GetDatabase(); var transactionId = Guid.NewGuid().ToString(); string messageId = await GetQueuedMessageId(transactionId, timeout ?? TimeSpan.FromSeconds(60)); if (messageId != null) { var message = await GetMessage(messageId); if (message != null) { var deliveryCount = message.Item2 + 1; // retryCount + 1 var transaction = new RedisMessageTransaction( message.Item1, deliveryCount, () => CommitTransaction(transactionId, messageId), () => FailTransaction(transactionId, messageId)); return(transaction); } } return(null); }
public async Task<IMessageTransaction> Receive(TimeSpan? timeout = null) { var redis = this.connection.GetDatabase(); var transactionId = Guid.NewGuid().ToString(); string messageId = await GetQueuedMessageId(transactionId, timeout ?? TimeSpan.FromSeconds(60)); if (messageId != null) { var message = await GetMessage(messageId); if (message != null) { var deliveryCount = message.Item2 + 1; // retryCount + 1 var transaction = new RedisMessageTransaction( message.Item1, deliveryCount, () => CommitTransaction(transactionId, messageId), () => FailTransaction(transactionId, messageId)); return transaction; } } return null; }