using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Amazon.Sqs.Wrapper.Interfaces { /// /// Interface to provide SQS Operations /// public interface IMessageQueue { /// /// Creates a Amazon Simple Queue Service (SQS) Queue. /// /// Name of SQS Queue /// A cancellation token that can be used by other objects or threads to receive /// notice of cancellation. /// Returns an int containing HttpStatusCode returned from Amazon SQS Task CreateQueueAsync(string queueName, CancellationToken ct = default); /// /// Deletes a Amazon Simple Queue Service (SQS) Queue. /// /// Name of SQS Queue /// A cancellation token that can be used by other objects or threads to receive /// notice of cancellation. /// Returns an int containing HttpStatusCode returned from Amazon SQS Task DeleteQueueAsync(string queueName, CancellationToken ct = default); /// /// Sends a message to Amazon Simple Queue Service (SQS) Queue. /// /// Generic message type containing message to be sent to SQS /// Optional queueUrl /// A cancellation token that can be used by other objects or threads to receive /// notice of cancellation. /// Returns a tuple containing message id and int containing HttpStatusCode returned from Amazon SQS Task<(string, int)> SendMessageAsync(TMessage message, string queueUrl = default, CancellationToken ct = default); /// /// Sends a message to Amazon Simple Queue Service (SQS) Queue. /// /// Generic message type containing message to be sent to SQS /// Message Group Id for FIFO queues /// deduplicationId for FIFO queues /// A cancellation token that can be used by other objects or threads to receive /// notice of cancellation. /// Returns a tuple containing message id and int containing HttpStatusCode returned from Amazon SQS Task<(string, int)> SendMessageAsync(TMessage message, string messageGroupId, string deduplicationId = default, CancellationToken ct = default); /// /// Receive one or more messages from Amazon Simple Queue Service (SQS) Queue. /// /// Delegate to process the message once its received /// A cancellation token that can be used by other objects or threads to receive /// notice of cancellation. Task ReceiveMessageAsync(Func, Task> messageProcessor, CancellationToken ct = default); /// /// Receive one or more messages from Amazon Simple Queue Service (SQS) Queue. /// /// A cancellation token that can be used by other objects or threads to receive /// notice of cancellation. /// Returns a list of IMessage received from Amazon SQS Task> ReceiveMessageAsync(CancellationToken ct = default); /// /// Deletes a Amazon Simple Queue Service (SQS) Queue. /// /// receiptHandle of message to be deleted from SQS Queue /// A cancellation token that can be used by other objects or threads to receive /// notice of cancellation. /// Returns an int containing HttpStatusCode returned from Amazon SQS Task DeleteMessageAsync(string receiptHandle, CancellationToken ct = default); } }