Interface IQueueService<T>
Defines the operations for interacting with a queue service for a specific type of queue messages.
Namespace: Innovt.Cloud.Queue
Assembly: Innovt.Cloud.dll
Syntax
public interface IQueueService<T> where T : IQueueMessage
Type Parameters
Name | Description |
---|---|
T | The type of queue messages. |
Methods
| Edit this page View SourceApproximateMessageCountAsync(CancellationToken)
Retrieves the approximate number of messages in the queue asynchronously.
Declaration
Task<int> ApproximateMessageCountAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<int> | The approximate message count in the queue. |
CreateIfNotExistAsync(CancellationToken)
Creates the queue if it does not already exist asynchronously.
Declaration
Task CreateIfNotExistAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
DeQueueAsync(string, CancellationToken)
Removes a message from the queue asynchronously.
Declaration
Task DeQueueAsync(string popReceipt, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | popReceipt | The pop receipt of the message to be removed. |
CancellationToken | cancellationToken | A cancellation token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
EnQueueAsync<TK>(TK, int?, CancellationToken)
Enqueues a message asynchronously.
Declaration
Task<string> EnQueueAsync<TK>(TK message, int? visibilityTimeoutInSeconds = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
TK | message | The message to be enqueued. |
int? | visibilityTimeoutInSeconds | The duration for which the enqueued message is invisible to other consumers. |
CancellationToken | cancellationToken | A cancellation token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<string> | The message ID associated with the enqueued message. |
Type Parameters
Name | Description |
---|---|
TK | The type of the message to be enqueued. |
EnQueueBatchAsync(IEnumerable<MessageBatchRequest>, int?, CancellationToken)
Enqueues a batch of messages asynchronously.
Declaration
Task<IList<MessageQueueResult>> EnQueueBatchAsync(IEnumerable<MessageBatchRequest> message, int? delaySeconds = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<MessageBatchRequest> | message | The collection of messages to be enqueued. |
int? | delaySeconds | The delay in seconds before the messages become available for retrieval. |
CancellationToken | cancellationToken | A cancellation token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<IList<MessageQueueResult>> | A list of message enqueue results. |
GetMessagesAsync(int, int?, int?, CancellationToken)
Retrieves a list of messages from the queue asynchronously.
Declaration
Task<IList<T>> GetMessagesAsync(int quantity, int? waitTimeInSeconds = null, int? visibilityTimeoutInSeconds = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | quantity | The number of messages to retrieve. |
int? | waitTimeInSeconds | The maximum time to wait for messages to become available. |
int? | visibilityTimeoutInSeconds | The duration for which retrieved messages are invisible to other consumers. |
CancellationToken | cancellationToken | A cancellation token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<IList<T>> | A list of retrieved messages. |