public void hash_codes_for_receipt_handles_with_same_handle_value_are_always_equal() { var random = new Random((int)GlobalClock.UtcNow.Ticks); for(var i = 0; i < 1000; i++) { var sqsReceiptHandle = random.Next(); var sqsReceiptHandleHash = new SqsMessageReceipt(sqsReceiptHandle.ToString(CultureInfo.InvariantCulture)).GetHashCode(); var sqsReceiptHandles = Enumerable.Repeat(sqsReceiptHandle, 1000).Select(integer => integer.ToString(CultureInfo.InvariantCulture).GetHashCode()).ToArray(); // Test that the hash codes match for(var j = 0; j < sqsReceiptHandles.Count(); j++) { Assert.AreEqual(sqsReceiptHandleHash, sqsReceiptHandles[j], string.Format("SqsReceiptHandle '{0}' with hash '{1}', its clone did not match its hash '{2}'", sqsReceiptHandle, sqsReceiptHandleHash, sqsReceiptHandles[j])); } } }
public void hash_codes_for_receipt_handles_with_same_handle_value_are_always_equal() { var random = new Random((int)GlobalClock.UtcNow.Ticks); for (var i = 0; i < 1000; i++) { var sqsReceiptHandle = random.Next(); var sqsReceiptHandleHash = new SqsMessageReceipt(sqsReceiptHandle.ToString(CultureInfo.InvariantCulture)).GetHashCode(); var sqsReceiptHandles = Enumerable.Repeat(sqsReceiptHandle, 1000).Select(integer => integer.ToString(CultureInfo.InvariantCulture).GetHashCode()).ToArray(); // Test that the hash codes match for (var j = 0; j < sqsReceiptHandles.Count(); j++) { Assert.AreEqual(sqsReceiptHandleHash, sqsReceiptHandles[j], string.Format("SqsReceiptHandle '{0}' with hash '{1}', its clone did not match its hash '{2}'", sqsReceiptHandle, sqsReceiptHandleHash, sqsReceiptHandles[j])); } } }
/// <summary> /// Delete single message from named queue. /// </summary> /// <param name="queueName">Queue name.</param> /// <param name="messageReceipt">Message receipt.</param> /// <returns>True if message was deleted.</returns> public bool DeleteMessage(SqsQueueName queueName, SqsMessageReceipt messageReceipt) { var msgQueue = GetQueue(queueName); AssertQueueIsNotNull(queueName, msgQueue); lock(msgQueue) { var entry = msgQueue.FirstOrDefault(x => x.Message.MessageReceipt == messageReceipt); if(entry != null) { msgQueue.Remove(entry); } } return true; }
public bool DeleteMessage(SqsQueueName queueName, SqsMessageReceipt messageReceipt) { _log.DebugFormat("deleting {0}", messageReceipt); Deleted.Add(messageReceipt); return true; }
//--- Constructors --- /// <summary> /// Constructor for creating an instance. /// </summary> /// <param name="messageId">Message ID.</param> /// <param name="messageReceipt">Message receipt.</param> /// <param name="body">Message body.</param> public SqsMessage(SqsMessageId messageId, SqsMessageReceipt messageReceipt, string body) { this.MessageId = messageId; this.MessageReceipt = messageReceipt; this.Body = body; }
/// <summary> /// Delete single message. /// </summary> /// <param name="messageReceipt">Message receipt.</param> /// <returns>True if message was deleted.</returns> public bool DeleteMessage(SqsMessageReceipt messageReceipt) { return _client.DeleteMessage(QueueName, messageReceipt); }
public bool DeleteMessage(SqsQueueName queueName, SqsMessageReceipt messageReceipt) { throw new NotImplementedException(); }
public bool DeleteMessage(SqsQueueName queueName, SqsMessageReceipt messageReceipt) { _log.DebugFormat("deleting {0}", messageReceipt); Deleted.Add(messageReceipt); return(true); }