Exemple #1
0
        public void DeleteMessageFromQueue(string messageId, Address address)
        {
            using (var client = GetClient())
            {
                if (_log.IsDebugEnabled)
                {
                    _log.Debug("Deleting message: " + address.ToString() + "/" + messageId);
                }

                using (var tran = client.CreateTransaction())
                {
                    tran.QueueCommand(c => c.RemoveItemFromList(_keyNameProvider.GetClaimedMessageIdListName(address), messageId, -1));   //LREM the messageId
                    tran.QueueCommand(c => c.Remove(_keyNameProvider.GetMessageClaimTimeoutKey(address, messageId)));                     //DEL the timeout
                    tran.QueueCommand(c => c.Hashes[_keyNameProvider.GetMessageHashName(address)].Remove(messageId));                     //HDEL the message
                    tran.QueueCommand(c => c.RemoveItemFromList(_keyNameProvider.GetMessageIdQueueName(address), messageId, -1));         //LREM the messageId

                    tran.Commit();
                }

                if (_log.IsDebugEnabled)
                {
                    _log.Debug("Deleted message: " + address.ToString() + "/" + messageId);
                }
            }
        }
 protected string GetMessageClaimTimeoutKey(Address address, string messageId)
 {
     return(_keyNameProvider.GetMessageClaimTimeoutKey(address, messageId));
     //return GetBaseQueueName(address) + ":timeout:" + messageId;
 }