Class AzureQueue<TRequest>
- Namespace
- Savvyio.Extensions.QueueStorage
- Assembly
- Savvyio.Extensions.QueueStorage.dll
Represents the base class from which all implementations of Azure Storage Queue should derive.
public abstract class AzureQueue<TRequest> where TRequest : IRequest
Type Parameters
TRequestThe type of the request.
- Inheritance
-
AzureQueue<TRequest>
- Derived
Constructors
AzureQueue(IMarshaller, AzureQueueOptions, Func<IMessage<TRequest>, IMarshaller, string>, Func<QueueMessage, IMarshaller, IMessage<TRequest>>)
Initializes a new instance of the AzureQueue<TRequest> class.
protected AzureQueue(IMarshaller marshaller, AzureQueueOptions options, Func<IMessage<TRequest>, IMarshaller, string> sendMessageFormatter = null, Func<QueueMessage, IMarshaller, IMessage<TRequest>> receiveMessageFormatter = null)
Parameters
marshallerIMarshallerThe marshaller used for serializing and deserializing messages.
optionsAzureQueueOptionsThe AzureQueueOptions used to configure this instance.
sendMessageFormatterFunc<IMessage<TRequest>, IMarshaller, string>The function delegate to format messages for sending. If null, a default formatter is used.
receiveMessageFormatterFunc<QueueMessage, IMarshaller, IMessage<TRequest>>The function delegate to format messages for receiving. If null, a default formatter is used.
Remarks
The following table shows the initial field values for an instance of AzureQueue<TRequest>.
| Field | Initial Value |
|---|---|
| Savvyio.Extensions.QueueStorage.AzureQueue<TRequest>._sendMessageFormatter |
|
Exceptions
- ArgumentNullException
marshallercannot be null - or -optionscannot be null.- ArgumentException
optionsare not in a valid state.
Methods
ReceiveMessagesAsync(Action<AsyncOptions>)
Receives messages from the Azure Storage Queue.
protected IAsyncEnumerable<IMessage<TRequest>> ReceiveMessagesAsync(Action<AsyncOptions> setup = null)
Parameters
setupAction<AsyncOptions>The AsyncOptions which may be configured.
Returns
- IAsyncEnumerable<IMessage<TRequest>>
A task that represents the asynchronous operation. The task result contains a sequence of IMessage<T> whose generic type argument is
TRequest.
SendMessageAsync(IEnumerable<IMessage<TRequest>>, Action<AsyncOptions>)
Sends the specified messages to the Azure Storage Queue.
protected Task SendMessageAsync(IEnumerable<IMessage<TRequest>> messages, Action<AsyncOptions> setup = null)
Parameters
messagesIEnumerable<IMessage<TRequest>>The messages to send.
setupAction<AsyncOptions>The AsyncOptions which may be configured.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- ArgumentNullException
messagescannot be null.