Esempio n. 1
0
        /// <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 response = Invoke(() =>
                                  _client.DeleteMessage(new DeleteMessageRequest {
                QueueUrl      = GetQueueUrl(queueName.Value),
                ReceiptHandle = messageReceipt.Value
            }),
                                  queueName,
                                  DELETING_MESSAGE
                                  );

            AssertSuccessfulStatusCode(response.HttpStatusCode, queueName, DELETING_MESSAGE);
            return(response.HttpStatusCode == HttpStatusCode.OK);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
 /// <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));
 }
Esempio n. 4
0
 /// <summary>
 /// Compare SQS message receipts.
 /// </summary>
 /// <param name="messageReceipt">Other SQS message receipt.</param>
 /// <returns>True if equal.</returns>
 public bool Equals(SqsMessageReceipt messageReceipt)
 {
     return(Value.Equals(messageReceipt.Value));
 }